Fix compiler to preserve action version comments during deduplication#8011
Merged
Fix compiler to preserve action version comments during deduplication#8011
Conversation
Add version comments (# v6.1.0) to actions/setup-go@4dc6199 in: - ci-coach.lock.yml - go-logger.lock.yml - hourly-ci-cleaner.lock.yml These three workflows were missing version comments on their setup-go action uses. The actions were already pinned to the correct SHA, but lacked the inline version comment that documents which version tag the SHA corresponds to. Fixes #7992 Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Pin the remaining unpinned GitHub Action to SHA
Add missing version comments to setup-go action uses
Dec 29, 2025
The DeduplicateRuntimeSetupStepsFromCustomSteps function was stripping version comments from action uses during YAML unmarshal/marshal cycle. When YAML parses "uses: action@sha # v1.0.0", it treats "# v1.0.0" as a comment and discards it. Solution: 1. Extract version comments before unmarshaling YAML 2. Restore them to the uses field before marshaling back 3. Call unquoteUsesWithComments to handle quoted strings with # characters This ensures version comments are preserved throughout the workflow compilation process, achieving 100% action pinning compliance. Fixes: Three workflows (ci-coach, go-logger, hourly-ci-cleaner) now have proper version comments on their actions/setup-go@SHA uses. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
Fixed in commit cb667b3. The compiler's |
Copilot
AI
changed the title
Add missing version comments to setup-go action uses
Fix compiler to preserve action version comments during deduplication
Dec 29, 2025
pelikhan
approved these changes
Dec 29, 2025
This was referenced Dec 29, 2025
Merged
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.
The workflow compiler was stripping version comments (e.g.,
# v6.1.0) from action uses during the deduplication process, causing three workflows to appear as if they had unpinned actions.Root Cause
The
DeduplicateRuntimeSetupStepsFromCustomStepsfunction inpkg/workflow/runtime_setup.gowas losing version comments during YAML processing because:#as a comment delimiteruses: action@sha # v6.1.0, the parser discarded# v6.1.0as a commentChanges Made
Updated
pkg/workflow/runtime_setup.go:unquoteUsesWithCommentsto handle YAML's automatic quoting of strings with#Affected workflows (now fixed):
.github/workflows/ci-coach.lock.yml.github/workflows/go-logger.lock.yml.github/workflows/hourly-ci-cleaner.lock.ymlResult
✅ All 5,715 external action uses across 126 workflows now have proper version comments
✅ 100% action pinning compliance achieved (5,715/5,715)
✅ All unit tests pass
✅ All workflows recompile successfully
The fix ensures version comments are preserved throughout the entire workflow compilation process, preventing this issue from occurring in future compilations.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.