Skip to content

Commit e7c3416

Browse files
authored
Gate copilot-review on same-repo PRs, not author_association (#1594)
The pull_request_target event payload reports author_association as CONTRIBUTOR for org members on same-repo branches (confirmed via the debug-event job added in #1592 and fired by #1593), so the previous gate filtered out every maintainer PR. Switch to head.repo.full_name == base.repo.full_name. Same-repo PRs require push access to the base repo, which is the maintainer signal we actually want. Fork PRs (where the maintainer cannot push to base) remain excluded. Also removes the now-unneeded debug-event job.
1 parent b50e7f5 commit e7c3416

1 file changed

Lines changed: 4 additions & 13 deletions

File tree

.github/workflows/copilot-review.yml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,13 @@ permissions:
88
pull-requests: write
99

1010
jobs:
11-
debug-event:
12-
runs-on: ubuntu-latest
13-
steps:
14-
- name: Print gate inputs
15-
run: |
16-
echo "action=${{ github.event.action }}"
17-
echo "draft=${{ github.event.pull_request.draft }}"
18-
echo "assoc=${{ github.event.pull_request.author_association }}"
19-
echo "user=${{ github.event.pull_request.user.login }}"
20-
echo "head_repo=${{ github.event.pull_request.head.repo.full_name }}"
21-
echo "base_repo=${{ github.event.pull_request.base.repo.full_name }}"
22-
2311
request-copilot-review:
12+
# Same-repo PRs only. author_association in the pull_request_target payload
13+
# reports CONTRIBUTOR for org members on same-repo branches, so head==base
14+
# is the reliable maintainer signal (it requires push access to the base repo).
2415
if: >-
2516
github.event.pull_request.draft == false &&
26-
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association)
17+
github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
2718
runs-on: ubuntu-latest
2819
steps:
2920
- name: Request Copilot review

0 commit comments

Comments
 (0)