fix: correct bots: placement under on: for agent activation#65
fix: correct bots: placement under on: for agent activation#65
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the gh-aw “Review Responder” and “Quality Gate” workflows’ frontmatter to allow all roles and to constrain execution to the Copilot reviewer bot via compiled allowlisting behavior.
Changes:
- Add
roles: allalongside existingbots: [copilot-pull-request-reviewer]in the gh-aw workflow sources. - Re-compile gh-aw workflows, removing the prior
pre_activationmembership gate and wiring bot allowlisting viaGH_AW_ALLOWED_BOTS. - Remove references to the deleted
pre_activationoutputs in the compiled workflows.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| .github/workflows/review-responder.md | Adds roles: all in the gh-aw workflow frontmatter for PR review-triggered responder. |
| .github/workflows/review-responder.lock.yml | Regenerated compiled workflow: drops pre_activation gating and adds GH_AW_ALLOWED_BOTS. |
| .github/workflows/quality-gate.md | Adds roles: all in the gh-aw workflow frontmatter for PR review-triggered quality gate. |
| .github/workflows/quality-gate.lock.yml | Regenerated compiled workflow: drops pre_activation gating and adds GH_AW_ALLOWED_BOTS. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Move bots: under on: so the compiler emits GH_AW_ALLOWED_BOTS in the lock file. The check_membership.cjs script checks allowed bots alongside required roles, letting the Copilot reviewer bot bypass the role gate. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
e6c3b56 to
88ca712
Compare
There was a problem hiding this comment.
Pull request overview
Updates the gh-aw “Review Responder” and “Quality Gate” workflows to explicitly allow the copilot-pull-request-reviewer bot, ensuring these workflows can activate and run when triggered by bot-submitted PR reviews.
Changes:
- Move
bots: [copilot-pull-request-reviewer]into theon:block in the source workflow markdown files. - Regenerate compiled workflow lockfiles to include
GH_AW_ALLOWED_BOTSin the relevantactions/github-scriptsteps (e.g., sanitization and pre-activation membership checks).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| .github/workflows/review-responder.md | Adjusts frontmatter so the workflow declares the allowed bot trigger under on:. |
| .github/workflows/review-responder.lock.yml | Compiled output updated to carry bot allowlist into runtime env (GH_AW_ALLOWED_BOTS). |
| .github/workflows/quality-gate.md | Adjusts frontmatter so the workflow declares the allowed bot trigger under on:. |
| .github/workflows/quality-gate.lock.yml | Compiled output updated to carry bot allowlist into runtime env (GH_AW_ALLOWED_BOTS). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
check_membership.cjs has a bug where the error branch from a 404 (GitHub App actors are not users) exits before the bot allowlist fallback is evaluated. This makes the bots: field ineffective. Workaround: roles: all skips the permission check entirely so check_membership.cjs is not included in pre_activation. Previous attempts that didn't fix this: - PR #64: bots: at top level (ignored by compiler) - PR #65: bots: under on: (correct placement, but runtime bug) - PR #72: added Copilot to bots list (correct actor, but bot check unreachable) Tracked for removal when upstream is fixed: #74 Upstream bug: github/gh-aw#21098 Closes #75 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Closes #70
Related: #53
Problem
PR #64 added
bots: [copilot-pull-request-reviewer]at the top level of the frontmatter inreview-responder.mdandquality-gate.md. The gh-aw compiler accepted this silently but did not emitGH_AW_ALLOWED_BOTSinto the compiled lock files. Result: thepre_activationgate still checked onlyGH_AW_REQUIRED_ROLES: admin,maintainer,write, and the Copilot reviewer bot (which has no repo role) was blocked.How check_membership.cjs works
From the gh-aw source (
check_membership.test.cjs):GH_AW_REQUIRED_ROLESGH_AW_ALLOWED_BOTSauthorized_botSo
GH_AW_ALLOWED_BOTSin the lock file is sufficient — noroles: allneeded.What this PR does
Moves
bots:from top-level to underon:in both workflows:Before (PR #64 — no effect):
Lock file:
GH_AW_REQUIRED_ROLES: admin,maintainer,writeonly.After (this PR):
Lock file:
GH_AW_REQUIRED_ROLES: admin,maintainer,write+GH_AW_ALLOWED_BOTS: copilot-pull-request-reviewer.Companion repo setting change
This PR alone is not sufficient. GitHub Actions also has its own approval gate (
action_required) for outside contributors that blocks workflow runs before any jobs execute. The repo setting "Approval for running fork pull request workflows" was changed to "Require approval for first-time contributors who are new to GitHub" (least restrictive option that still blocks suspicious new accounts). Additionally, "Allow GitHub Actions to create and approve pull requests" was enabled for the quality-gate agent to submit approval reviews.