Skip to content

Commit fce81ed

Browse files
igerberclaude
andcommitted
Reword checkout comment to drop SHA-immutability overstatement
The previous comment said the head SHA was "frozen the moment the PR is created," which misreads `pulls.get`: it returns the PR's current head SHA at API-call time, which can change as the PR receives more commits. The accurate framing is that the metadata step resolves the head SHA for *this* workflow run, and the checkout step uses that already-resolved value. Same wording fix applied to the base-side race description so it does not over-promise either. No behavior change. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 894146f commit fce81ed

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

.github/workflows/ai_pr_review.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,24 @@ jobs:
8080
8181
- uses: actions/checkout@v6
8282
with:
83-
# Check out the PR head by immutable SHA. The previous workflow used
84-
# `refs/pull/<N>/merge`, which GitHub garbage-collects on closed/merged
85-
# PRs and breaks `/ai-review` reruns post-merge. `refs/pull/<N>/head`
86-
# is durable for merged PRs but is documented as racy right after
87-
# API-created PR creation (see .claude/commands/submit-pr.md:327-345).
88-
# The head SHA on `pulls.get` is frozen the moment the PR is created,
89-
# so checking it out directly avoids both failure modes. The diff the
90-
# reviewer sees is unchanged: it's computed from the frozen
91-
# BASE_SHA/HEAD_SHA below, not from the checked-out filesystem.
83+
# Check out the PR head by SHA, resolved by the metadata step above.
84+
# The previous workflow used `refs/pull/<N>/merge`, which GitHub
85+
# garbage-collects on closed/merged PRs and breaks `/ai-review`
86+
# reruns post-merge. `refs/pull/<N>/head` is durable for merged PRs
87+
# but is documented as racy right after API-created PR creation
88+
# (see .claude/commands/submit-pr.md:327-345). Checking out the SHA
89+
# the metadata step just got from `pulls.get` avoids both failure
90+
# modes. The diff the reviewer sees is unchanged: it's computed
91+
# from BASE_SHA/HEAD_SHA below, captured in the same metadata step.
9292
ref: ${{ steps.pr.outputs.head_sha }}
9393

9494
- name: Pre-fetch base SHA
9595
run: |
9696
set -euo pipefail
9797
# Fetch the base-side commit by SHA so `git diff BASE_SHA HEAD_SHA`
9898
# has both trees locally. Using the SHA (not base_ref) avoids the
99-
# race where main has moved past base_sha after the PR was opened.
99+
# race where the base branch has moved past base_sha between the
100+
# metadata-resolution step and this fetch.
100101
git fetch --no-tags --depth=1 origin "${{ steps.pr.outputs.base_sha }}"
101102
102103
- name: Fetch previous AI review (if any)

0 commit comments

Comments
 (0)