ci(claude): checkout with fetch-depth: 0 so the review bot works on fork PRs#1671
Merged
Merged
Conversation
…ork PRs The Claude Code workflow (claude.yml) had no checkout step, so claude-code-action runs its own shallow `git fetch --depth=20 pull/<n>/head`. On fork PRs that fetch fails (the shallow base lacks the objects to reconcile), aborting the action before it can review. Adding a fetch-depth: 0 checkout gives the action the history it needs, mirroring the working claude-code-review.yml.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Claude Code GitHub Actions workflow to ensure the anthropics/claude-code-action@v1 step has sufficient git history available to successfully fetch and reconcile fork-based PR heads (avoiding failures caused by shallow history).
Changes:
- Add an explicit
actions/checkoutstep withfetch-depth: 0ahead of the Claude action. - Document why the full-history checkout is required and align behavior with
claude-code-review.yml.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
Claude Codeworkflow (.github/workflows/claude.yml) has no checkout step, soanthropics/claude-code-action@v1performs its own shallowgit fetch --depth=20 pull/<n>/headto obtain the PR. On fork PRs that fetch fails — the shallow base lacks the objects needed to reconcile the PR head — and the whole action aborts before it can post a review:(Observed on #1670.)
This adds a full-history checkout (
fetch-depth: 0) before the action, giving it the history it needs so the internal fetch succeeds. This mirrors the siblingclaude-code-review.yml, which already checks out withfetch-depth: 0and does not hit this failure.Type of change
Testing
yaml.safe_load)../mfc.sh precheckpasses.Checklist