From e3b6dbb6c6991043f890ab5753e89a5bb54b8d4d Mon Sep 17 00:00:00 2001 From: Will Button Date: Thu, 3 Sep 2026 11:34:02 -0600 Subject: [PATCH] feat(claude-code-review): make checkout fetch-depth a caller input devops's own inline review workflow used fetch-depth: 0 deliberately (PR #1589, andres-monje): the review's "historical git context" pass walks history against the base branch to check whether a claim about surrounding code still holds on main, and a shallow checkout has no ancestry for that walk, so it can re-flag an issue elsewhere in a touched file that a since-merged commit already fixed on main. Migrating devops to this shared workflow would have silently dropped that fix - the checkout here was hardcoded to fetch-depth: 1. Rather than change the default for every consumer (some may prefer the faster shallow checkout and not need the historical pass), expose it as an optional fetch_depth input, default 1 (unchanged behavior), so repos that want full history can opt in per-repo. --- .../ai-platform-claude-code-review.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ai-platform-claude-code-review.yml b/.github/workflows/ai-platform-claude-code-review.yml index 745be61..a833ecf 100644 --- a/.github/workflows/ai-platform-claude-code-review.yml +++ b/.github/workflows/ai-platform-claude-code-review.yml @@ -32,6 +32,7 @@ # uses: 0xPolygon/pipelines/.github/workflows/ai-platform-claude-code-review.yml@main # with: # mode: approve +# # fetch_depth: 0 # full history — see the input's description below # secrets: # CLAUDE_API_KEY: ${{ secrets.CLAUDE_API_KEY }} @@ -54,6 +55,22 @@ on: type: string required: false default: 'claude-sonnet-4-6' + fetch_depth: + description: >- + Passed straight through to the checkout step's `fetch-depth`. The + default (1) is a shallow checkout — fine for judging the diff in + isolation, but the review also does a "historical git context" + pass (git log / git blame against the base branch) to check + whether a claim about surrounding code still holds on `main`, e.g. + to avoid re-flagging an issue elsewhere in a touched file that a + since-merged commit already fixed. A shallow checkout has no + ancestry for that pass to walk, so it can't verify those claims + and may re-flag stale issues. Set to 0 (full history) for repos + where that historical pass matters; leave at 1 for repos that + prioritize checkout speed over it. + type: number + required: false + default: 1 secrets: CLAUDE_API_KEY: required: true @@ -124,7 +141,7 @@ jobs: - name: Checkout repository uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 with: - fetch-depth: 1 + fetch-depth: ${{ inputs.fetch_depth }} - name: Run Claude Code Review (comment) if: inputs.mode == 'comment'