Scope ${GITHUB_*} → ${{github.*}} rewrite to non-run: contexts#384
Merged
Conversation
cloudofficer-admin
previously approved these changes
May 15, 2026
Previously the workflow writer applied a blanket regex substitution
across the rendered YAML, which:
- Translated ${GITHUB_*} in shell `run:` bodies, where the env-var form
is the runner-exported syntax shellcheck expects (the ${{github.*}}
form is opaque to shellcheck and trips SC2193), and
- Was still needed for env:/if:/with:/concurrency:/run-name: values,
where ${GITHUB_*} is *not* shell-expanded and the canonical
expression form is required.
Walk the parsed YAML tree before serialization and only rewrite values
whose enclosing key is not `run`. Shell bodies stay verbatim; every
other context still gets the canonical ${{github.*}} form.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
cloudofficer-admin
approved these changes
May 15, 2026
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.
Summary
The workflow writer was running a blanket regex substitution across the entire rendered YAML, rewriting every
${GITHUB_*}into the GitHub expression form${{github.*}}. That rewrite is correct forenv:,if:,with:,concurrency:,run-name:, etc. (where${GITHUB_*}is not shell-expanded and the canonical expression form is required), but wrong inside shellrun:blocks: there${GITHUB_*}is the env-var syntax the runner actually exports, while${{github.*}}is opaque to shellcheck and trips SC2193.Instead of removing the translation outright (the first attempt — which broke
env:values that have no other way to interpolategithub.*context), this scopes it: we walk the parsed YAML tree before serialization and skip values whose enclosing key isrun. Every other context still gets the canonical${{github.*}}form.Key changes:
gsub!inWorkflow#writewith a recursiverewrite_github_refshelper that walks the hash/array structure and applies the regex only to non-run:string valuesprivate_constant(GITHUB_ENV_VAR_REGEX)${GITHUB_*}→${{github.*}}spec (env: context, still translated) and add a new spec verifying${GITHUB_*}inside steprun:bodies is preserved verbatimTypes of changes
Checklist