Skip to content

Commit 8efa677

Browse files
committed
test(ci): pin the labeler to the permissions the API demands
1 parent 9933017 commit 8efa677

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

‎.github/scripts/pr-labeler.test.cjs‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,15 @@ describe("pr-labeler workflow", () => {
165165
it("keeps trusted default-branch checkout, concurrency cancel, and minimal permissions", () => {
166166
assert.match(workflow, /ref:\s*\$\{\{\s*github\.event\.repository\.default_branch\s*\}\}/);
167167
assert.match(workflow, /cancel-in-progress:\s*true/);
168-
assert.match(workflow, /pull-requests:\s*read/);
169168
assert.match(workflow, /issues:\s*write/);
170-
assert.doesNotMatch(workflow, /pull-requests:\s*write/);
169+
// The issues label endpoints are shared with pull requests: writing a label
170+
// onto a PR number needs pull_requests=write alongside issues=write, which
171+
// GitHub reports as `issues=write; pull_requests=write`. Pinning this to
172+
// read made the workflow fail closed on the first PR that actually needed a
173+
// label applied (#565), so write is the minimum here, not an escalation.
174+
assert.match(workflow, /pull-requests:\s*write/);
175+
// contents stays read — the labeler never pushes.
176+
assert.match(workflow, /contents:\s*read/);
177+
assert.doesNotMatch(workflow, /contents:\s*write/);
171178
});
172179
});

0 commit comments

Comments
 (0)