komplian 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/komplian-onboard.mjs +7 -6
- package/package.json +1 -1
package/komplian-onboard.mjs
CHANGED
|
@@ -96,7 +96,8 @@ function ghApiJson(path) {
|
|
|
96
96
|
function verifyOrgMembership(org) {
|
|
97
97
|
const enc = encodeURIComponent(org);
|
|
98
98
|
const mem = ghApiJson(`user/memberships/orgs/${enc}`);
|
|
99
|
-
|
|
99
|
+
/** spawnSync().status = código de salida de `gh` (0 = éxito), no código HTTP. */
|
|
100
|
+
if (mem.status === 0) {
|
|
100
101
|
try {
|
|
101
102
|
const j = JSON.parse(mem.stdout);
|
|
102
103
|
if (j.state === "active") return;
|
|
@@ -109,7 +110,8 @@ function verifyOrgMembership(org) {
|
|
|
109
110
|
process.exit(1);
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
|
-
|
|
113
|
+
const hint = (mem.stderr + mem.stdout).toLowerCase();
|
|
114
|
+
if (hint.includes("404") || hint.includes("not found")) {
|
|
113
115
|
log(
|
|
114
116
|
`${c.red}✗${c.reset} Esta cuenta ${c.bold}no es miembro${c.reset} de la org ${c.bold}${org}${c.reset}.`
|
|
115
117
|
);
|
|
@@ -118,21 +120,20 @@ function verifyOrgMembership(org) {
|
|
|
118
120
|
);
|
|
119
121
|
process.exit(1);
|
|
120
122
|
}
|
|
121
|
-
|
|
122
|
-
if (mem.status === 403 || hint.includes("read:org") || hint.includes("scope")) {
|
|
123
|
+
if (hint.includes("403") || hint.includes("read:org") || hint.includes("scope")) {
|
|
123
124
|
log(`${c.red}✗${c.reset} Falta scope ${c.bold}read:org${c.reset} en gh.`);
|
|
124
125
|
log(`${c.dim} gh auth refresh -h github.com -s repo -s read:org${c.reset}`);
|
|
125
126
|
process.exit(1);
|
|
126
127
|
}
|
|
127
128
|
log(
|
|
128
|
-
`${c.red}✗${c.reset} No se pudo verificar la org (${mem.status}):\n${c.dim}${(mem.stderr || mem.stdout).trim()}${c.reset}`
|
|
129
|
+
`${c.red}✗${c.reset} No se pudo verificar la org (código ${mem.status}):\n${c.dim}${(mem.stderr || mem.stdout).trim()}${c.reset}`
|
|
129
130
|
);
|
|
130
131
|
process.exit(1);
|
|
131
132
|
}
|
|
132
133
|
|
|
133
134
|
function logGhIdentity() {
|
|
134
135
|
const u = ghApiJson("user");
|
|
135
|
-
if (u.status !==
|
|
136
|
+
if (u.status !== 0) return;
|
|
136
137
|
try {
|
|
137
138
|
const j = JSON.parse(u.stdout);
|
|
138
139
|
if (j.login) {
|
package/package.json
CHANGED