Skip to content

fix: gh aw upgrade always corrects with: version: drift in copilot-setup-steps.yml#20896

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/fix-gh-aw-version-drift-again
Closed

fix: gh aw upgrade always corrects with: version: drift in copilot-setup-steps.yml#20896
Copilot wants to merge 3 commits intomainfrom
copilot/fix-gh-aw-version-drift-again

Conversation

Copy link
Contributor

Copilot AI commented Mar 14, 2026

gh aw upgrade updated the uses: SHA/comment but silently left with: version: stale whenever pre-existing drift existed between the two fields.

Root cause: upgradeSetupCliVersionInContent built its versionInWithPattern regex anchored to the exact new uses: value (escapedNewUses). Since the match was tied to the just-written ref string, any prior mismatch between uses: comment and with: version: bypassed the version update entirely.

Changes

  • pkg/cli/copilot_setup.go: Replace the runtime-compiled, escapedNewUses-anchored versionInWithPattern with a pre-compiled setupCliVersionInWithPattern that matches any setup-cli uses: line (SHA-pinned, version tag, quoted, or unquoted). The with: version: update is now independent of the exact ref format.

  • pkg/cli/copilot_setup_test.go: Add two regression cases covering the drift scenario — SHA-pinned uses: comment ahead of a stale with: version:, and same with a version-tag ref.

Before (broken when drift existed):

- uses: github/gh-aw/actions/setup-cli@cb796... # v0.58.0  ← updated
  with:
    version: v0.53.6  ← silently not updated

After:

- uses: github/gh-aw/actions/setup-cli@newsha... # v0.60.0  ← updated
  with:
    version: v0.60.0  ← now always updated

Copilot AI and others added 3 commits March 13, 2026 23:13
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…eps.yml

Use a pre-compiled pattern that matches any setup-cli uses: line (not anchored
to the exact new ref) so that pre-existing drift between the uses: comment
version and with: version: is always corrected on upgrade.

Fixes #<issue>

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.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.

gh aw upgrade does not correct drift between uses: comment version and with: version: in copilot-setup-steps.yml

2 participants