feat(auth): sync git credentials with switched account - #7
Conversation
| const skipMatchingVersion = core.getBooleanInput("skip-matching-version"); | ||
| const gitTokenEnvName = "SETUP_GH_GIT_TOKEN"; | ||
| const gitAuthConfigPattern = | ||
| "^(credential\\.helper|http(\\..*)?\\.extraheader|url\\..*\\.insteadof)$"; |
There was a problem hiding this comment.
WARNING: The auth-config pattern only matches the bare credential.helper key and omits URL-scoped credential helpers (e.g. credential.https://github.com.helper / credential.<host>.helper).
On self-hosted runners — the stated use case for update-git-credentials — stale GitHub-scoped credential helpers may be configured under a URL subsection. Such entries are neither surfaced by debugGitAuthConfigOrigins (which reuses this same pattern) nor removed by scrubLocalGitAuthConfig, because shouldUnsetLocalGitAuthConfig only special-cases the bare credential.helper. The empty helper = reset written to GIT_CONFIG_GLOBAL does not backstop this either: it is read before local config, so later-accumulated local URL-scoped helpers are never cleared. A stale credential.<host>.helper entry can therefore keep feeding an outdated token to raw git, bypassing the askpass credentials this feature installs.
Extending the pattern to match credential(?:\\..*)?\\.helper and adding a corresponding server-scoped branch in shouldUnsetLocalGitAuthConfig would close the gap.
Reply with @kilocode-bot fix it to have Kilo Code address this issue.
Code Review SummaryStatus: 1 Issue Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (4 files)
Fix these issues in Kilo Cloud Reviewed by glm-5.2-short · Input: 46.1K · Output: 14.3K · Cached: 364.9K |
|
Superseded by the standalone setup-git-credentials action: https://github.com/kostua16/setup-git-credentials. Closing this setup-gh PR so raw Git credential switching has a single owner. |
Summary
feat(auth): sync raw git credentials with the switched GitHub account
update-git-credentialsinput, defaulting tofalse.GIT_ASKPASS,GIT_TERMINAL_PROMPT=0, a masked token env var,GIT_CONFIG_GLOBAL, andGIT_CONFIG_NOSYSTEM=1.gitcommands without writing tokenized URLs to persistent Git config.switch-account: true+update-git-credentials: truePAT usage and extend action smoke coverage.Feature Notes
Pros:
git pushaligned with the account selected bysetup-gh.Cons:
Impact
Build time:
Support activities:
ghuses the intended PAT but rawgitstill uses an old GitHub App/default token.Validation
npx tsc --noEmitnpm run buildactionlint .github/workflows/test-action.yml .github/workflows/publish-action.ymlgit diff --checkupdate-git-credentials: trueupdate-git-credentials: false