Skip to content

Commit fc22758

Browse files
authored
fix(ci): skip pending-maintainer label writes on fork PR review events (#1442)
pull_request_review runs triggered by fork PRs get a read-only GITHUB_TOKEN, so the label add/remove calls fail with 403 "Resource not accessible by integration" (e.g. every review submitted on #1440). Guard the job: only handle pull_request_review when the PR head repo is this repo. Fork PR labels stay eventually-consistent via the hourly schedule / workflow_dispatch reconciliation, which runs with a full token. Co-authored-by: chaodu-agent <chaodu-agent@users.noreply.github.com>
1 parent 6859733 commit fc22758

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

.github/workflows/pending-maintainer.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,16 @@ on:
1111

1212
jobs:
1313
check-pending:
14-
if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || github.event.issue.pull_request != null || github.event.pull_request != null
14+
# Fork guard: pull_request_review on a fork PR gets a read-only GITHUB_TOKEN,
15+
# so label writes would 403 ("Resource not accessible by integration").
16+
# Skip those runs — the hourly schedule / workflow_dispatch reconciliation
17+
# (full token) keeps fork PR labels correct.
18+
if: >-
19+
github.event_name == 'workflow_dispatch' ||
20+
github.event_name == 'schedule' ||
21+
github.event.issue.pull_request != null ||
22+
(github.event.pull_request != null &&
23+
github.event.pull_request.head.repo.full_name == github.repository)
1524
runs-on: ubuntu-latest
1625
permissions:
1726
pull-requests: write

0 commit comments

Comments
 (0)