@attalabs/vinaya 0.8.1 → 0.8.2
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.
|
@@ -3146,14 +3146,43 @@ function resolvePrBody() {
|
|
|
3146
3146
|
}
|
|
3147
3147
|
return "";
|
|
3148
3148
|
}
|
|
3149
|
-
function
|
|
3150
|
-
|
|
3151
|
-
|
|
3149
|
+
function fetchPrLabels(prNumber) {
|
|
3150
|
+
try {
|
|
3151
|
+
const out = execFileSync3("gh", ["pr", "view", String(prNumber), "--json", "labels"], {
|
|
3152
|
+
encoding: "utf8",
|
|
3153
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
3154
|
+
});
|
|
3155
|
+
return JSON.parse(out).labels.map((l) => l.name);
|
|
3156
|
+
} catch {
|
|
3157
|
+
return null;
|
|
3158
|
+
}
|
|
3159
|
+
}
|
|
3160
|
+
function fetchWaiverLabelActor(prNumber, label2) {
|
|
3161
|
+
try {
|
|
3162
|
+
const out = execFileSync3("gh", ["api", `repos/{owner}/{repo}/issues/${prNumber}/timeline`, "--paginate"], {
|
|
3163
|
+
encoding: "utf8",
|
|
3164
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
3165
|
+
});
|
|
3166
|
+
const events = JSON.parse(out);
|
|
3167
|
+
const matches = events.filter((e) => e.event === "labeled" && e.label?.name === label2);
|
|
3168
|
+
return matches[matches.length - 1]?.actor?.login ?? null;
|
|
3169
|
+
} catch {
|
|
3170
|
+
return null;
|
|
3171
|
+
}
|
|
3172
|
+
}
|
|
3173
|
+
function waiverActive() {
|
|
3174
|
+
const prNumberStr = process.env.PR_NUMBER;
|
|
3175
|
+
if (!prNumberStr)
|
|
3176
|
+
return false;
|
|
3177
|
+
const prNumber = Number(prNumberStr);
|
|
3178
|
+
const labels = fetchPrLabels(prNumber);
|
|
3179
|
+
if (!labels?.includes(WAIVER_LABEL))
|
|
3152
3180
|
return false;
|
|
3181
|
+
const labelActor = fetchWaiverLabelActor(prNumber, WAIVER_LABEL);
|
|
3153
3182
|
return isWaiverLabelActorVerified({
|
|
3154
3183
|
label: WAIVER_LABEL,
|
|
3155
3184
|
labels,
|
|
3156
|
-
labelActor
|
|
3185
|
+
labelActor,
|
|
3157
3186
|
principalAllowlist: resolvePrincipalAllowlist(loadTrustAnchorConfig())
|
|
3158
3187
|
});
|
|
3159
3188
|
}
|
|
@@ -3166,7 +3195,7 @@ function main() {
|
|
|
3166
3195
|
process.exit(0);
|
|
3167
3196
|
}
|
|
3168
3197
|
const content = existsSync(DOC_OWNERS_PATH) ? readFileSync(DOC_OWNERS_PATH, "utf8") : null;
|
|
3169
|
-
const result = evaluateC5(changed, content, resolvePrBody(), existsSync,
|
|
3198
|
+
const result = evaluateC5(changed, content, resolvePrBody(), existsSync, waiverActive());
|
|
3170
3199
|
if (result.errors.length > 0) {
|
|
3171
3200
|
for (const message of result.errors) {
|
|
3172
3201
|
emitCheckError({
|
package/dist/index.js
CHANGED
|
@@ -2970,8 +2970,7 @@ function coreCheckRegistry() {
|
|
|
2970
2970
|
BASE_SHA: { optional: true },
|
|
2971
2971
|
PR_BODY: { optional: true },
|
|
2972
2972
|
PR_BODY_FILE: { optional: true },
|
|
2973
|
-
|
|
2974
|
-
WAIVER_LABEL_ACTOR: { optional: true },
|
|
2973
|
+
PR_NUMBER: { optional: true },
|
|
2975
2974
|
GITHUB_REPOSITORY: { optional: true },
|
|
2976
2975
|
GITHUB_TOKEN: { optional: true },
|
|
2977
2976
|
GH_TOKEN: { optional: true }
|
package/package.json
CHANGED