-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: fetch remote branch before checkout in update-copilot-dependency workflow #1088
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,8 +79,9 @@ jobs: | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
|
|
||
| if git rev-parse --verify "origin/$BRANCH" >/dev/null 2>&1; then | ||
| git fetch origin "$BRANCH" | ||
| git checkout "$BRANCH" | ||
| git reset --hard HEAD | ||
| git reset --hard "origin/$BRANCH" | ||
|
Comment on lines
83
to
+84
|
||
| else | ||
| git checkout -b "$BRANCH" | ||
| fi | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git rev-parse --verify "origin/$BRANCH"only checks for a local remote-tracking ref. On a fresh Actions checkout this ref typically won’t exist for non-default branches, so this condition can still be false even when the remote branch exists—meaning the newgit fetch origin "$BRANCH"never runs and--force-with-leasecan remain stale. Consider checking remote existence viagit ls-remote --exit-code --heads origin "$BRANCH"(or attempting an explicit refspec fetch and branching on its exit code), then fetching+refs/heads/$BRANCH:refs/remotes/origin/$BRANCHto ensure the tracking ref is populated/updated.