Skip to content

Fix compiler escaping of literal ${{ in YAML heredocs#9280

Closed
Copilot wants to merge 3 commits intomainfrom
copilot/fix-invalid-workflow-file
Closed

Fix compiler escaping of literal ${{ in YAML heredocs#9280
Copilot wants to merge 3 commits intomainfrom
copilot/fix-invalid-workflow-file

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 7, 2026

GitHub Actions YAML parser interprets ${{ as expression start even inside quoted heredocs. Workflow markdown containing bash grep patterns like grep '\${{ github\.event\.' caused compilation errors: "The expression is not closed."

Changes

  • Added escapeGitHubActionsExpressions() in pkg/workflow/sh.go - replaces ${{ with $${{ for YAML parser
  • Updated heredoc writers - WritePromptTextToYAML(), WritePromptTextToYAMLWithPlaceholders(), and compiler_yaml.go chunk writers now escape expressions before writing lines
  • Recompiled affected workflows - daily-secrets-analysis, cloclo, plan now have properly escaped grep patterns

Example

Before (invalid YAML):

run: |
  cat << 'PROMPT_EOF'
  grep '\${{ github\.event\.' file.yml
  PROMPT_EOF

After (valid YAML):

run: |
  cat << 'PROMPT_EOF'
  grep '\$${{ github\.event\.' file.yml
  PROMPT_EOF

GitHub Actions processes $${{${{ in the bash script, preserving the intended grep pattern.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/user
    • Triggering command: /usr/bin/gh gh api user --jq .login xterm-color x_amd64/link (http block)
    • Triggering command: /usr/bin/gh gh api user --jq .login runs/20260107-23/tmp/gh-aw-test-runs/20260107-230609-60282/test-orchestrator-2053235492/run-1008infocmp --jq /usr/bin/infocmp 13924/run-1008 GO111MODULE 64/pkg/tool/linu/repos/actions/github-script/git/ref/tags/v8 infocmp -1 /ref/tags/v8 64/pkg/tool/linuREDACTED 087802821/gh-aw 140/config.json GO111MODULE rtcfg.link 087802821/gh-aw (http block)
    • Triggering command: /usr/bin/gh gh api user --jq .login /repos/actions/g/tmp/gh-aw-test-runs/20260107-230609-60282/test-orchestrator-4011807806/run-100 --jq /usr/bin/infocmp 5745ddd960829958f78a9f9841395b21b1d/log.json GO111MODULE 64/pkg/tool/linuuser infocmp -1 xterm-color eo/GFhb1wP7Cfs1Frev-parse le-integration-2526765884/gh-aw -json GO111MODULE erts/ca-certifi le-integration-2526765884/gh-aw (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Investigate https://github.com/githubnext/gh-aw/actions/runs/20798814704/workflow#L491

Invalid workflow file: .github/workflows/daily-secrets-analysis.lock.yml#L1
(Line: 491, Col: 14): The expression is not closed. An unescaped ${{ sequence was found, but the closing }} sequence was not found.

Fix compiler


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 7, 2026 23:01
- Add escapeGitHubActionsExpressions() function to escape ${{ as $${{
- Update WritePromptTextToYAML to escape literal expressions
- Update WritePromptTextToYAMLWithPlaceholders to escape literal expressions
- Update compiler_yaml.go to escape expressions in prompt chunks
- Add comprehensive tests for expression escaping
- Recompile daily-secrets-analysis workflow with fix

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- daily-secrets-analysis: Escape literal ${{ in grep patterns
- cloclo: Escape ${{ in template conditionals
- plan: Escape ${{ in template conditionals

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix compiler for invalid workflow file Fix compiler escaping of literal ${{ in YAML heredocs Jan 7, 2026
Copilot AI requested a review from pelikhan January 7, 2026 23:13
@pelikhan pelikhan closed this Jan 8, 2026
@mnkiefer mnkiefer deleted the copilot/fix-invalid-workflow-file branch January 8, 2026 20:09
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.

2 participants