Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…uring gh aw upgrade Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
March 14, 2026 02:36
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes gh aw upgrade leaving a stale with: version: when the uses: ref/comment and with.version were already out of sync, by decoupling the version: update regex from the exact upgraded uses: value.
Changes:
- Replace a runtime-constructed regex (anchored to
newUses) with a package-level precompiledversionInWithPatternthat matches any valid setup-cliuses:line. - Add regression tests covering pre-existing drift for both SHA-pinned and version-tag
uses:formats.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/cli/copilot_setup.go | Makes with: version: replacement independent of the exact uses: ref to handle pre-upgrade drift. |
| pkg/cli/copilot_setup_test.go | Adds drift-focused test cases ensuring both uses: and with.version are updated together. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Contributor
|
@copilot lint go |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
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.
gh aw upgradesilently leftwith: version:stale when theuses:comment andwith: version:were already out of sync—e.g., someone manually bumped the SHA without updating the CLI version parameter.Root cause:
versionInWithPatternwas constructed at runtime anchored to the exactnewUsesvalue viaregexp.QuoteMeta. If drift existed prior to the upgrade, the newuses:line matched, but the subsequentversion:search was still coupled to that precise ref string in a way that failed under certain drift conditions.Changes:
pkg/cli/copilot_setup.go— Replace the runtimeregexp.MustCompile+regexp.QuoteMetaconstruction with a package-level pre-compiledversionInWithPattern. The new regex matches any valid setup-cliuses:line (version tag, SHA-pinned, or quoted form), makingwith: version:updates independent of ref format and any pre-existing drift:pkg/cli/copilot_setup_test.go— Add two drift test cases toTestUpgradeSetupCliVersionInContent: SHA-pinned ref with staleversion:, and version-tag ref with staleversion:.