Skip to content

docs: restrict PR reviewer workflows to COMMENT-only by default#47860

Merged
pelikhan merged 2 commits into
mainfrom
copilot/update-aw-instructions-for-pr-reviewer
Jul 24, 2026
Merged

docs: restrict PR reviewer workflows to COMMENT-only by default#47860
pelikhan merged 2 commits into
mainfrom
copilot/update-aw-instructions-for-pr-reviewer

Conversation

Copilot AI commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

GITHUB_TOKEN in GitHub Actions is only permitted to post COMMENT reviews — it cannot APPROVE or REQUEST_CHANGES. The pr-reviewer.md instruction file had no guidance on this, leaving agents free to attempt operations that fail at runtime.

Changes

  • .github/aw/pr-reviewer.md: Added "Default Review Event: COMMENT Only" section
    • States the GITHUB_TOKEN constraint explicitly
    • Prescribes allowed-events: [COMMENT] as the default safe-outputs configuration
    • Warns that APPROVE/REQUEST_CHANGES require a PAT or app token with explicit pull-request approval permissions
safe-outputs:
  submit-pull-request-review:
    max: 1
    allowed-events: [COMMENT]

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Comment thread .github/aw/pr-reviewer.md Outdated

## Default Review Event: COMMENT Only

**The GitHub Actions actor (`GITHUB_TOKEN`) is only permitted to post `COMMENT` reviews. It cannot `APPROVE` or `REQUEST_CHANGES` on a pull request.**

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot it can request changes but not approve

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2b4bad9 — updated to allowed-events: [COMMENT, REQUEST_CHANGES] and clarified that only APPROVE is blocked by the default GITHUB_TOKEN.

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan July 24, 2026 21:11
@pelikhan
pelikhan marked this pull request as ready for review July 24, 2026 21:14
Copilot AI review requested due to automatic review settings July 24, 2026 21:14
@pelikhan
pelikhan merged commit 7cebb30 into main Jul 24, 2026
@pelikhan
pelikhan deleted the copilot/update-aw-instructions-for-pr-reviewer branch July 24, 2026 21:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Documents safe review events for workflows using the default GITHUB_TOKEN.

Changes:

  • Adds review-event guidance and configuration, but incorrectly permits REQUEST_CHANGES.
Show a summary per file
File Description
.github/aw/pr-reviewer.md Adds default review-event guidance and example.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (2)

.github/aw/pr-reviewer.md:42

  • The example still permits REQUEST_CHANGES, contrary to the documented COMMENT-only default. A workflow copied from this snippet can select an event that the default token cannot submit, so the allowlist must contain only COMMENT.
    allowed-events: [COMMENT, REQUEST_CHANGES]

.github/aw/pr-reviewer.md:45

  • The warning only covers APPROVE, leaving readers with the incorrect conclusion that REQUEST_CHANGES works with GITHUB_TOKEN. Include both unsupported events so the guidance is consistent with the COMMENT-only constraint.
Do not instruct the agent to approve a PR unless the workflow uses a PAT or app token with explicit pull-request approval permissions. Using `APPROVE` with the default `GITHUB_TOKEN` will fail at runtime.
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Medium

Comment thread .github/aw/pr-reviewer.md
Comment on lines +32 to +36
## Default Review Events: No APPROVE

**The GitHub Actions actor (`GITHUB_TOKEN`) cannot `APPROVE` a pull request. It can post `COMMENT` and `REQUEST_CHANGES` reviews.**

By default, configure `submit-pull-request-review` with `allowed-events: [COMMENT, REQUEST_CHANGES]` to enforce this constraint:
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This pull request is included in a new release.

Release: v0.83.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants