fix: preserve checked-out repo remote URL in configureGitAuth#966
Open
vasilii-bolgar-212 wants to merge 1 commit intoanthropics:mainfrom
Open
fix: preserve checked-out repo remote URL in configureGitAuth#966vasilii-bolgar-212 wants to merge 1 commit intoanthropics:mainfrom
vasilii-bolgar-212 wants to merge 1 commit intoanthropics:mainfrom
Conversation
configureGitAuth() was constructing the remote URL from context.repository (GITHUB_REPOSITORY env var), which is always the workflow's host repo. When actions/checkout checks out a different repo, the action would overwrite the origin remote to point at the wrong repository, breaking subsequent git push steps. Now reads the current remote URL and injects the auth token into it, preserving whatever repo actions/checkout set up. Falls back to the previous context.repository behavior if reading the remote fails. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Open
1 task
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
configureGitAuth()was constructing the git remote URL fromcontext.repository(GITHUB_REPOSITORYenv var), which is always the workflow's host repo. Whenactions/checkoutchecks out a different repo into the workspace, the action overwrites theoriginremote to point at the wrong repository, breaking subsequentgit pushsteps.git remote get-url originand injects the auth token into it, preserving whatever repoactions/checkoutset up. Falls back to the previouscontext.repositorybehavior if reading the remote fails.Test plan
bun run typecheckpassesbun test— all 652 tests passactions/checkoutchecks out the same repo as the workflow (normal case) — behavior should be identicalactions/checkoutchecks out a different repo — origin remote should now be preserved correctly🤖 Generated with Claude Code