Skip to content

fix(ci): indent heredoc content in release workflow#424

Merged
CybotTM merged 1 commit intomainfrom
fix/release-workflow-yaml
Dec 23, 2025
Merged

fix(ci): indent heredoc content in release workflow#424
CybotTM merged 1 commit intomainfrom
fix/release-workflow-yaml

Conversation

@CybotTM
Copy link
Copy Markdown
Member

@CybotTM CybotTM commented Dec 23, 2025

Summary

  • Fix invalid YAML in release workflow caused by unindented heredoc content
  • Heredoc content with triple backticks (```) at column 0 breaks YAML parsing

Root Cause

The release workflow file had heredoc content that was not properly indented:

run: |
  cat > /tmp/file.md << 'EOF'
## Header              # <- This is at column 0
```bash                # <- YAML interprets ``` as invalid token
  code here

Heredoc content in shell scripts within YAML workflow files must be
indented to avoid YAML parsing errors. Content like ``` (triple
backticks) at column 0 is interpreted as YAML syntax, not shell content.

The workflow was silently broken since commit f1351bd, causing:
- Release events to not trigger the workflow at all
- Scorecard to report inability to parse the workflow file

Fix by indenting heredoc content and stripping indentation with sed.
Copilot AI review requested due to automatic review settings December 23, 2025 13:41
@CybotTM CybotTM enabled auto-merge December 23, 2025 13:41
@github-actions
Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails
actions/docker/build-push-action 263435318d21b8e681c14492fe198d362a7d2c83 🟢 5.5
Details
CheckScoreReason
Maintained🟢 101 commit(s) and 11 issue activity found in the last 90 days -- score normalized to 10
Binary-Artifacts🟢 10no binaries found in the repo
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Code-Review🟢 7Found 7/9 approved changesets -- score normalized to 7
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Security-Policy🟢 9security policy file detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration
Packaging🟢 10packaging workflow detected
Vulnerabilities⚠️ 012 existing vulnerabilities detected
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
actions/docker/login-action 74a5d142397b4f367a81961eba4e8cd7edddf772 🟢 4.8
Details
CheckScoreReason
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Packaging⚠️ -1packaging workflow not detected
Code-Review🟢 3Found 1/3 approved changesets -- score normalized to 3
Security-Policy🟢 9security policy file detected
Binary-Artifacts🟢 10no binaries found in the repo
Maintained🟢 44 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 4
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration
Vulnerabilities⚠️ 19 existing vulnerabilities detected
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
SAST🟢 9SAST tool detected but not run on all commits
actions/docker/metadata-action 902fa8ec7d6ecbf8d84d538b9b233a880e428804 🟢 5
Details
CheckScoreReason
Code-Review⚠️ 2Found 1/4 approved changesets -- score normalized to 2
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Binary-Artifacts🟢 10no binaries found in the repo
Maintained🟢 1030 commit(s) and 5 issue activity found in the last 90 days -- score normalized to 10
Security-Policy🟢 9security policy file detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration
Signed-Releases⚠️ -1no releases found
Packaging🟢 10packaging workflow detected
Vulnerabilities⚠️ 010 existing vulnerabilities detected
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
actions/docker/setup-buildx-action b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 🟢 4.5
Details
CheckScoreReason
Maintained🟢 54 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 5
Binary-Artifacts🟢 10no binaries found in the repo
Security-Policy🟢 9security policy file detected
Code-Review⚠️ 2Found 2/7 approved changesets -- score normalized to 2
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration
Packaging🟢 10packaging workflow detected
Vulnerabilities⚠️ 010 existing vulnerabilities detected
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
actions/docker/setup-qemu-action 29109295f81e9208d7d86ff1c6c12d2833863392 🟢 4.7
Details
CheckScoreReason
Maintained🟢 1019 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10
Security-Policy🟢 9security policy file detected
Binary-Artifacts🟢 10no binaries found in the repo
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Packaging⚠️ -1packaging workflow not detected
Code-Review⚠️ 2Found 1/5 approved changesets -- score normalized to 2
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration
Signed-Releases⚠️ -1no releases found
Vulnerabilities⚠️ 19 existing vulnerabilities detected
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0
actions/imjasonh/setup-crane 31b88efe9de28ae0ffa220711af4b60be9435f6e 🟢 4
Details
CheckScoreReason
Maintained⚠️ 00 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Packaging⚠️ -1packaging workflow not detected
Code-Review⚠️ 2Found 3/14 approved changesets -- score normalized to 2
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Binary-Artifacts🟢 10no binaries found in the repo
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Vulnerabilities🟢 100 existing vulnerabilities detected
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ -1internal error: error during branchesHandler.setup: internal error: some github tokens can't read classic branch protection rules: https://github.com/ossf/scorecard-action/blob/main/docs/authentication/fine-grained-auth-token.md
Security-Policy⚠️ 0security policy file not detected
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0

Scanned Files

  • .github/workflows/release-slsa.yml

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes YAML syntax errors in the GitHub Actions release workflow caused by heredoc content that wasn't properly indented, which resulted in markdown triple backticks (```) being interpreted as invalid YAML tokens at column 0.

Key Changes:

  • Indented all heredoc content to match YAML nesting level and added sed commands to strip indentation before use
  • Changed heredoc delimiters from unquoted to quoted to prevent premature variable expansion
  • Modified verification instructions to write to a temporary file first, then strip indentation and append to release notes

VERIFICATION_EOF

# Strip indentation and replace placeholder
sed 's/^ //' /tmp/verification.md | sed "s/RELEASE_TAG_PLACEHOLDER/${RELEASE_TAG}/g" >> /tmp/notes.md
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sed command uses a fixed-width indentation pattern that assumes exactly 10 spaces. If the YAML indentation level changes in the future (e.g., if this code block is moved to a different nesting level), this will silently fail to strip the correct amount of indentation. Consider using a more flexible pattern like sed 's/^[[:space:]]*//' to strip all leading whitespace, or document the exact indentation requirement.

Suggested change
sed 's/^ //' /tmp/verification.md | sed "s/RELEASE_TAG_PLACEHOLDER/${RELEASE_TAG}/g" >> /tmp/notes.md
sed 's/^[[:space:]]*//' /tmp/verification.md | sed "s/RELEASE_TAG_PLACEHOLDER/${RELEASE_TAG}/g" >> /tmp/notes.md

Copilot uses AI. Check for mistakes.
PR_EOF
If you encounter any issues, please open a new issue.
PR_EOF
sed -i 's/^ //' /tmp/pr_comment.md
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sed command uses a fixed-width indentation pattern that assumes exactly 12 spaces. If the YAML indentation level changes in the future (e.g., if this code block is moved to a different nesting level), this will silently fail to strip the correct amount of indentation. Consider using a more flexible pattern like sed 's/^[[:space:]]*//' to strip all leading whitespace, or document the exact indentation requirement.

Copilot uses AI. Check for mistakes.
ISSUE_EOF
If the issue persists or you find related problems, please open a new issue.
ISSUE_EOF
sed -i 's/^ //' /tmp/issue_comment.md
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sed command uses a fixed-width indentation pattern that assumes exactly 14 spaces. If the YAML indentation level changes in the future (e.g., if this code block is moved to a different nesting level), this will silently fail to strip the correct amount of indentation. Consider using a more flexible pattern like sed 's/^[[:space:]]*//' to strip all leading whitespace, or document the exact indentation requirement.

Copilot uses AI. Check for mistakes.
Comment on lines +395 to +403
cat > /tmp/pr_comment.md << 'PR_EOF'
🚀 **Released in [${RELEASE_TAG}](${RELEASE_URL})**

Thank you for your contribution! 🙏
Thank you for your contribution! 🙏

This is now available in the latest release. Please test and verify everything works as expected in your environment.
This is now available in the latest release. Please test and verify everything works as expected in your environment.

If you encounter any issues, please open a new issue.
PR_EOF
If you encounter any issues, please open a new issue.
PR_EOF
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The heredoc delimiter has been changed from unquoted to quoted ('PR_EOF'), which prevents variable expansion. However, the content still uses shell variable syntax (${RELEASE_TAG}, ${RELEASE_URL}). These variables are now literal strings that need to be replaced by the subsequent sed commands on line 405. While this works, it adds unnecessary complexity. Consider either: (1) using an unquoted delimiter and letting shell expand the variables naturally, or (2) keeping the quoted delimiter but documenting why variable expansion is deferred to sed.

Copilot uses AI. Check for mistakes.
Comment on lines +423 to +431
cat > /tmp/issue_comment.md << 'ISSUE_EOF'
🚀 **Released in [${RELEASE_TAG}](${RELEASE_URL})**

Thank you for reporting this! 🙏
Thank you for reporting this! 🙏

The fix/feature is now available in the latest release. Please update and verify everything works as expected.
The fix/feature is now available in the latest release. Please update and verify everything works as expected.

If the issue persists or you find related problems, please open a new issue.
ISSUE_EOF
If the issue persists or you find related problems, please open a new issue.
ISSUE_EOF
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The heredoc delimiter has been changed from unquoted to quoted ('ISSUE_EOF'), which prevents variable expansion. However, the content still uses shell variable syntax (${RELEASE_TAG}, ${RELEASE_URL}). These variables are now literal strings that need to be replaced by the subsequent sed commands on line 433. While this works, it adds unnecessary complexity. Consider either: (1) using an unquoted delimiter and letting shell expand the variables naturally, or (2) keeping the quoted delimiter but documenting why variable expansion is deferred to sed.

Copilot uses AI. Check for mistakes.
sed -i "s/RELEASE_TAG_PLACEHOLDER/${RELEASE_TAG}/g" /tmp/notes.md
# Append verification instructions (indented for YAML, then stripped)
cat > /tmp/verification.md << 'VERIFICATION_EOF'
---
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The heredoc content starts with "---" on line 197, which will be included in the verification output. This appears to be a YAML front matter delimiter that doesn't belong in the markdown verification instructions. This line should be removed as it serves no purpose in the release notes and could confuse users.

Suggested change
---

Copilot uses AI. Check for mistakes.
Merged via the queue into main with commit 9cc0646 Dec 23, 2025
51 of 55 checks passed
@CybotTM CybotTM deleted the fix/release-workflow-yaml branch December 23, 2025 13:45
CybotTM added a commit that referenced this pull request Dec 23, 2025
- Remove stray --- from verification section
- Use unquoted heredocs for PR/Issue comments (natural variable expansion)
- Remove redundant sed variable substitution commands

Addresses Copilot review comments from PR #424.
github-merge-queue bot pushed a commit that referenced this pull request Dec 23, 2025
## Summary

Addresses Copilot review comments from PR #424:

- Remove stray `---` from verification section (was incorrectly
included)
- Use unquoted heredocs for PR/Issue comments (enables natural variable
expansion)
- Remove redundant `sed` variable substitution commands

## Test plan

- [x] YAML validates with `yq eval`
- [ ] Release workflow triggers correctly on next release
@CybotTM CybotTM added the released:v0.17.1 Released in v0.17.1 label Dec 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released:v0.17.1 Released in v0.17.1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants