Request Copilot review on agent PRs via the shared workflow - #30
Open
Quasar-Apps-Agent wants to merge 2 commits into
Open
Request Copilot review on agent PRs via the shared workflow#30Quasar-Apps-Agent wants to merge 2 commits into
Quasar-Apps-Agent wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a repository-level GitHub Actions workflow that calls the org-wide reusable workflow (QuasarApps/.github) to automatically request Copilot review for PRs, addressing the limitation where GitHub’s built-in auto-request rules don’t trigger for PRs authored by a non-subscribed agent account.
Changes:
- Introduces a new
pull_request_targetworkflow that calls the shared Copilot review requester workflow. - Passes
COPILOT_REVIEW_PATexplicitly (instead ofsecrets: inherit) to minimize secret exposure. - Documents key security/operational expectations (base-branch attachment, no
synchronize, and whypull_request_targetis used).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+21
to
+26
| on: | ||
| pull_request_target: | ||
| types: [opened, reopened, ready_for_review] | ||
|
|
||
| permissions: {} | ||
|
|
Comment on lines
+27
to
+34
| jobs: | ||
| request: | ||
| uses: QuasarApps/.github/.github/workflows/copilot-review.yml@main | ||
| # Named rather than `inherit`: inherit hands the called workflow every | ||
| # secret this repo has, which is more than it needs and more than would | ||
| # be obvious to whoever reads this file next. | ||
| secrets: | ||
| COPILOT_REVIEW_PAT: ${{ secrets.COPILOT_REVIEW_PAT }} |
Comment on lines
+27
to
+30
| jobs: | ||
| request: | ||
| uses: QuasarApps/.github/.github/workflows/copilot-review.yml@main | ||
| # Named rather than `inherit`: inherit hands the called workflow every |
Both from Copilot's review of this rollout. A fork PR reaches this caller
under pull_request_target, and the secret was passed before the called
workflow's author gate could skip it; gating forks here means the secret
never enters that context. The author gate stays centralised so a rename
remains a one-place fix. permissions: {} was never actually exercised and
zero permissions can leave the job unable to resolve a workflow in another
repository — contents: read is the documented minimum.
Copilot also read the missing caller-level author gate as "runs for all
PRs, wasting premium requests on human ones". That part is not right: the
called workflow gates on author id before any API call, so a human PR
consumes nothing. The fork exposure it raised separately is the real
finding, and that is what this fixes.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (1)
.github/workflows/copilot-review.yml:28
- The caller workflow is missing
actions: readin itspermissions. GitHub requires bothcontents: readandactions: readfor the caller’sGITHUB_TOKENto fetch and run a reusable workflow from another repository (especially if the called repo is private). Withoutactions: read, this job may fail to resolveQuasarApps/.github/.github/workflows/copilot-review.yml@main.
permissions:
# Minimum needed to resolve the called workflow from another repository.
# Not `{}`: zero permissions can leave the job unable to fetch it.
contents: read
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the org-wide Copilot review caller. Proven in
scanprs-skill: an agent PR opened at 21:54:01 had a Copilot review at 21:55:32 — 1m31s, fully automatic.Why it's needed
GitHub's "Automatically request Copilot code review" ruleset only fires when the PR author has Copilot access and quota (documented limitation). PRs here are authored by
Quasar-Apps-Agent, which has no subscription — a personal plan onQuasar-Appscovers only that account, org membership notwithstanding. So the ruleset has never fired on them, and coverage has depended on the agent remembering to request a review by hand.This repo has a live example: #29 — "Fix two latent sync-dispatch bugs" — sat over an hour with no review at all, because nothing asked for one.
This supplies the requester identity the ruleset cannot: the review is requested as
Quasar-Apps, whose subscription covers it.What this file does and doesn't do
All logic lives in
QuasarApps/.github; this is 16 lines of trigger and secret. A fix lands once rather than in every repo.pull_request_target, notpull_request— the former reads the workflow definition from the base branch. Underpull_requestanyone with push access could edit the caller on a branch and exfiltrate the PAT. That trigger is only safe because the called workflow never checks out or executes PR code; don't add steps here that do.No
synchronize— each Copilot review costs 13 premium requests, so re-reviews after pushes stay a judgement call. Close and reopen to re-request.Two things to expect
This PR won't be auto-reviewed.
pull_request_targetreads from the base branch, which doesn't have the workflow yet. Same bootstrap everywhere — the first PR after this merges is the one that proves it.Runs won't appear in the PR's checks list. They attach to the base commit. Confirm via the Actions tab.
Requires
The org secret
COPILOT_REVIEW_PATmust reach this repo, and the PAT's own repository-access list must include it. Those are two separate settings: miss the first and the run saysCOPILOT_REVIEW_PAT is not set; miss the second and it's a bareHTTP 404. The workflow distinguishes them deliberately.🤖 Generated with Claude Code
Generated by Claude Code