From be04a6a826f2ce008a06f093cabeb2a7f425ab47 Mon Sep 17 00:00:00 2001 From: Jonathan Green Date: Wed, 10 Jun 2026 09:14:55 -0300 Subject: [PATCH] Allow commits to skip Claude review via a head-commit marker --- .github/workflows/claude-review.yml | 18 ++++++++++++++++++ README.md | 5 +++++ 2 files changed, 23 insertions(+) diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml index 9a1065f..ae3c0b0 100644 --- a/.github/workflows/claude-review.yml +++ b/.github/workflows/claude-review.yml @@ -30,8 +30,26 @@ jobs: steps: - name: Checkout caller repo uses: actions/checkout@v6 + with: + # Fetch the merge commit plus its parents so the PR head commit is + # available locally for the skip-marker check below. + fetch-depth: 2 + + - name: Check for skip marker + id: skip_check + run: | + message=$(git log -1 --format=%B "${{ github.event.pull_request.head.sha }}") + if grep -qiE '\[(skip[ -]claude|claude[ -]skip)\]' <<<"$message"; then + reason="Claude review skipped: the head commit message (${{ github.event.pull_request.head.sha }}) contains a skip marker such as [skip claude]. Remove the marker (or push a new commit without it) to run the review." + echo "::notice title=Claude review skipped::$reason" + echo "$reason" >> "$GITHUB_STEP_SUMMARY" + echo "skip=true" >> "$GITHUB_OUTPUT" + else + echo "skip=false" >> "$GITHUB_OUTPUT" + fi - name: Run Claude Code review + if: steps.skip_check.outputs.skip != 'true' uses: anthropics/claude-code-action@v1 with: claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} diff --git a/README.md b/README.md index 1ad4f24..88a5ac0 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,11 @@ jobs: Required secret: `CLAUDE_CODE_OAUTH_TOKEN`. +To skip the review for a given push, include `[skip claude]` (or `[skip-claude]`, +`[claude skip]`, `[claude-skip]`) anywhere in the PR's most recent commit message. The check is +case-insensitive and looks only at the head commit, so pushing a later commit +without the marker re-enables review on the next run. + Optional input `additional_prompt` appends repo-specific guidance to the default review prompt: