Replace persist-credentials with explicit git re-authentication#2664
Merged
Conversation
- Changed buildCheckoutRepository to use persist-credentials: false - Updated generateGitConfigurationSteps to add git remote set-url command - Updated all tests to expect persist-credentials: false - All unit tests passing Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update generated code to re-authenticate git
Replace persist-credentials with explicit git re-authentication
Oct 28, 2025
Contributor
|
Agentic Changeset Generator triggered by this pull request. |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR replaces the use of persist-credentials: true in GitHub Actions checkout steps with explicit git authentication using git remote set-url. This provides better control over credential scope by authenticating git explicitly when needed rather than persisting credentials throughout the workflow.
- Changed
persist-credentialsfromtruetofalsein checkout steps - Added explicit git remote URL configuration with GitHub token in git configuration steps
- Updated tests to reflect the new authentication pattern
Reviewed Changes
Copilot reviewed 60 out of 60 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/yaml_generation.go | Added git remote set-url command to re-authenticate with GitHub token |
| pkg/workflow/push_to_pull_request_branch.go | Changed persist-credentials to false in checkout configuration |
| pkg/workflow/git_config_test.go | Updated test assertions to expect 9 lines instead of 5 and added checks for new authentication commands |
| pkg/workflow/checkout_persist_credentials_test.go | Updated test names, descriptions, and logic to reflect that all jobs now use persist-credentials: false |
| .github/workflows/*.lock.yml (56 files) | Regenerated workflow files with new authentication pattern |
Comments suppressed due to low confidence (2)
pkg/workflow/yaml_generation.go:1
- The shell parameter expansion
${SERVER_URL#https://}removes only the literal prefix 'https://', butgithub.server_urlmay use 'http://' in some enterprise configurations. Consider using a more robust URL parsing approach or handle both protocols.
pkg/workflow/checkout_persist_credentials_test.go:1 - The variable
expectTrueJobsis now an empty map that is never populated, making the subsequent logic unnecessary. Consider removing this variable and simplifying the verification logic since all jobs should now usepersist-credentials: false.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Replaces
persist-credentials: truein checkout steps with explicit git authentication viagit remote set-urlto provide better control over credential scope.Changes
pkg/workflow/push_to_pull_request_branch.go: Setpersist-credentials: falseinbuildCheckoutRepository()pkg/workflow/yaml_generation.go: Add git remote set-url command togenerateGitConfigurationSteps()Before/After
Before:
After:
Impact
All 56 compiled workflows (
.lock.ymlfiles) regenerated with new authentication pattern.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.