ci: let a PR opt out of automatic AI review (#11984)

A PR whose body contains `[skip-ai-review]` no longer triggers the
automatic Codex, Pi and Claude reviews on open/ready/synchronize, and is
left out of the weekly merged-PR summary. Explicit requests (workflow_call
from the review commands) still run.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alexander Petric
2026-10-23 23:35:12 +02:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 001313aa24
commit 19204f5757
4 changed files with 11 additions and 4 deletions
+3 -1
View File
@@ -42,12 +42,14 @@ jobs:
# skips auto-review for every private member.
# Dependabot-triggered runs get a separate secret scope, so this job has no API
# key and cannot review. workflow_call stays open for an explicit request.
# `[skip-ai-review]` in the PR body opts out of the automatic run only.
if: |
github.event_name == 'workflow_call' ||
(
github.event.pull_request.draft == false &&
github.event.pull_request.head.repo.fork == false &&
github.event.pull_request.user.login != 'dependabot[bot]'
github.event.pull_request.user.login != 'dependabot[bot]' &&
!contains(github.event.pull_request.body, '[skip-ai-review]')
)
permissions:
contents: read
+3 -1
View File
@@ -40,12 +40,14 @@ jobs:
# skips auto-review for every private member.
# Dependabot-triggered runs get a separate secret scope, so this job has no API
# key and cannot review. workflow_call stays open for an explicit request.
# `[skip-ai-review]` in the PR body opts out of the automatic run only.
if: |
github.event_name == 'workflow_call' ||
(
github.event.pull_request.draft == false &&
github.event.pull_request.head.repo.fork == false &&
github.event.pull_request.user.login != 'dependabot[bot]'
github.event.pull_request.user.login != 'dependabot[bot]' &&
!contains(github.event.pull_request.body, '[skip-ai-review]')
)
permissions:
contents: read
+3 -1
View File
@@ -39,12 +39,14 @@ jobs:
# skips auto-review for every private member.
# Dependabot-triggered runs get a separate secret scope, so this job has no API
# key and cannot review. workflow_call stays open for an explicit request.
# `[skip-ai-review]` in the PR body opts out of the automatic run only.
if: |
github.event_name == 'workflow_call' ||
(
(github.event.pull_request.draft == false || github.event.pull_request.ready_for_review == true) &&
github.event.pull_request.head.repo.fork == false &&
github.event.pull_request.user.login != 'dependabot[bot]'
github.event.pull_request.user.login != 'dependabot[bot]' &&
!contains(github.event.pull_request.body, '[skip-ai-review]')
)
permissions:
contents: read
+2 -1
View File
@@ -39,9 +39,10 @@ jobs:
- This gives you the exact 7-day window (store these in variables for use in commands)
2. **Fetch ONLY Merged PRs from Past Week**:
- Command: `gh pr list --repo ${{ github.repository }} --state merged --search "merged:>=$CUTOFF_DATE" --limit 100 --json number,title,author,mergedAt,url`
- Command: `gh pr list --repo ${{ github.repository }} --state merged --search "merged:>=$CUTOFF_DATE" --limit 100 --json number,title,author,mergedAt,url,body --jq '[.[] | select((.body // "") | contains("[skip-ai-review]") | not) | del(.body)]'`
- This returns ONLY PRs that were merged in the last 7 days
- The --search flag filters by merge date using GitHub's search syntax
- The --jq filter drops PRs whose body contains `[skip-ai-review]`; never fetch or mention those PRs
- **FILTER OUT** any PRs with titles starting with "chore: release" or "chore(release)"
3. **Categorize PRs**: Group PRs into three categories by analyzing titles and labels: