Skip to content

fix: preserve checked-out repo remote URL in configureGitAuth#966

Open
vasilii-bolgar-212 wants to merge 1 commit intoanthropics:mainfrom
vasilii-bolgar-212:fix/preserve-checkout-remote-url
Open

fix: preserve checked-out repo remote URL in configureGitAuth#966
vasilii-bolgar-212 wants to merge 1 commit intoanthropics:mainfrom
vasilii-bolgar-212:fix/preserve-checkout-remote-url

Conversation

@vasilii-bolgar-212
Copy link

Summary

  • configureGitAuth() was constructing the git 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 into the workspace, the action overwrites the origin remote to point at the wrong repository, breaking subsequent git push steps.
  • Now reads the current git remote get-url origin 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.

Test plan

  • bun run typecheck passes
  • bun test — all 652 tests pass
  • Verify in a workflow where actions/checkout checks out the same repo as the workflow (normal case) — behavior should be identical
  • Verify in a workflow where actions/checkout checks out a different repo — origin remote should now be preserved correctly

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant