Skip to content

Commit dbcc398

Browse files
authored
fix(ci): switch assign-reviewers workflow to pull_request trigger (#9971)
Migrates .github/workflows/assign-reviewers.yml from pull_request_target to pull_request ahead of GitHub's default pull_request_target Actions event policy enforcement on public repositories. ### Changes - Replace on: pull_request_target with on: pull_request and remove the now-unneeded zizmor: ignore[dangerous-triggers] annotation. - Guard the assign-reviewers job to skip fork PRs (head.repo.full_name == github.repository) and Dependabot PRs (pull_request.user.login != 'dependabot[bot]'), since GITHUB_TOKEN is read-only for those pull_request runs; those PRs fall back to .github/CODEOWNERS team reviewers.
1 parent f6069d9 commit dbcc398

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

‎.github/workflows/assign-reviewers.yml‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
name: Auto Assign Reviewers
22

33
on:
4-
# pull_request_target is required to grant write permissions for reviewer assignment on fork PRs.
5-
# The workflow only runs github-script and does not check out or execute untrusted code.
6-
# zizmor: ignore[dangerous-triggers]
7-
pull_request_target:
4+
pull_request:
85
types: [opened, ready_for_review, reopened, synchronize, review_requested, assigned]
96

107
permissions:
@@ -18,7 +15,12 @@ concurrency:
1815
jobs:
1916
assign-reviewers:
2017
runs-on: ubuntu-latest
21-
if: github.event.pull_request.draft == false
18+
# Skip fork and Dependabot PRs: under pull_request, GITHUB_TOKEN is read-only for those runs,
19+
# so they fall back to .github/CODEOWNERS team reviewers instead of failing with 403.
20+
if: >-
21+
github.event.pull_request.draft == false &&
22+
github.event.pull_request.head.repo.full_name == github.repository &&
23+
github.event.pull_request.user.login != 'dependabot[bot]'
2224
steps:
2325
- name: Assign Reviewers
2426
continue-on-error: true

0 commit comments

Comments
 (0)