fix: remove head branch fetch and checkout that fails on dirty worktree#6
Open
andrmoel wants to merge 1 commit into
Open
fix: remove head branch fetch and checkout that fails on dirty worktree#6andrmoel wants to merge 1 commit into
andrmoel wants to merge 1 commit into
Conversation
When a consuming workflow runs yarn install before this action, yarn.lock may be modified. The subsequent git checkout of the PR head SHA fails because git refuses to overwrite the dirty file. The checkout is unnecessary: actions/checkout@v4 on pull_request events checks out a merge commit that already contains the PR changes on top of the base branch, so diff-cover produces the correct diff without switching commits.
Contributor
Original prompt from moeller
|
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
Removes the
git fetch origin <head-ref>andgit checkout <head-sha>commands from the "Fetch base branch for comparison" step.Problem: When a consuming workflow runs
yarn install(or similar) before this action,yarn.lockgets modified. The subsequentgit checkoutof the PR head SHA fails because git refuses to overwrite the dirty file:This has been breaking the "Check test coverage" job on every PR in
candidate-backendsince the Node 24 upgrade (April 2026), because Node 24's yarn now modifiesyarn.lockduring install on merge commits.Why the checkout is unnecessary:
actions/checkout@v4onpull_requestevents checks out a merge commit that already contains the PR's changes on top of the base branch.diff-cover --compare-branch=origin/mastertherefore produces the correct diff without needing to switch to the PR head commit.A previous attempt to fix this with
git checkout -f(commit 906d4b1) was merged and reverted within 17 minutes.Review & Testing Checklist for Human
candidate-backendPR (e.g. #5339) to verify it passesNotes
The only remaining git command in the step is
git fetch origin <base-ref>, which is needed sodiff-covercan compare againstorigin/master.Link to Devin session: https://app.devin.ai/sessions/91f6c3e0d63549379d22705dda69e5fd
Requested by: @andrmoel