Skip to content

Commit cac1fe5

Browse files
authored
fix(ci): fix heredoc syntax error in release notification job (#451)
## Summary - Replace heredoc+sed patterns with echo blocks in the release-slsa workflow - Fixes bash syntax error `unexpected end of file (wanted 'PR_EOF')` in the "Notify Released PRs/Issues" job ## Root Cause Heredoc closing delimiters (`PR_EOF`, `ISSUE_EOF`) inside `for` loops were indented by the YAML block scalar indentation. After YAML processing strips the base indentation, the delimiters still had 2-4 spaces of leading whitespace. Since `<<` (without `-`) requires the closing delimiter at column 0, bash fails with a syntax error. The `VERIFICATION_EOF` heredoc had the same fragile pattern (though it happened to work because it wasn't inside a loop). ## Fix Replace all three heredoc+sed patterns with simple `{ echo ...; } > file` blocks that are immune to YAML indentation issues. ## Failed run https://github.com/netresearch/ofelia/actions/runs/21807613643/job/62913771307
2 parents daacbd8 + 10963b5 commit cac1fe5

File tree

1 file changed

+44
-49
lines changed

1 file changed

+44
-49
lines changed

.github/workflows/release-slsa.yml

Lines changed: 44 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -196,33 +196,30 @@ jobs:
196196
exit 0
197197
fi
198198
199-
# Append verification instructions (indented for YAML, then stripped)
200-
cat > /tmp/verification.md << 'VERIFICATION_EOF'
201-
202-
## Verification
203-
204-
All binaries include SLSA Level 3 provenance attestations.
205-
206-
### Verify binary provenance
207-
```bash
208-
slsa-verifier verify-artifact ofelia-linux-amd64 \
209-
--provenance-path ofelia-linux-amd64.intoto.jsonl \
210-
--source-uri github.com/netresearch/ofelia
211-
```
212-
213-
### Verify checksums signature
214-
```bash
215-
cosign verify-blob \
216-
--certificate checksums.txt.pem \
217-
--signature checksums.txt.sig \
218-
--certificate-identity "https://github.com/netresearch/ofelia/.github/workflows/release-slsa.yml@refs/tags/RELEASE_TAG_PLACEHOLDER" \
219-
--certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
220-
checksums.txt
221-
```
222-
VERIFICATION_EOF
223-
224-
# Strip indentation and replace placeholder
225-
sed 's/^ //' /tmp/verification.md | sed "s/RELEASE_TAG_PLACEHOLDER/${RELEASE_TAG}/g" >> /tmp/notes.md
199+
# Append verification instructions
200+
{
201+
echo ""
202+
echo "## Verification"
203+
echo ""
204+
echo "All binaries include SLSA Level 3 provenance attestations."
205+
echo ""
206+
echo "### Verify binary provenance"
207+
echo '```bash'
208+
echo "slsa-verifier verify-artifact ofelia-linux-amd64 \\"
209+
echo " --provenance-path ofelia-linux-amd64.intoto.jsonl \\"
210+
echo " --source-uri github.com/netresearch/ofelia"
211+
echo '```'
212+
echo ""
213+
echo "### Verify checksums signature"
214+
echo '```bash'
215+
echo "cosign verify-blob \\"
216+
echo " --certificate checksums.txt.pem \\"
217+
echo " --signature checksums.txt.sig \\"
218+
echo " --certificate-identity \"https://github.com/netresearch/ofelia/.github/workflows/release-slsa.yml@refs/tags/${RELEASE_TAG}\" \\"
219+
echo " --certificate-oidc-issuer \"https://token.actions.githubusercontent.com\" \\"
220+
echo " checksums.txt"
221+
echo '```'
222+
} >> /tmp/notes.md
226223
227224
gh release edit "$RELEASE_TAG" --notes-file /tmp/notes.md
228225
@@ -399,17 +396,16 @@ jobs:
399396
# Add label
400397
gh pr edit "$pr" --add-label "released:${RELEASE_TAG}" 2>/dev/null || true
401398
402-
# Add comment (use unquoted heredoc for natural variable expansion)
403-
cat > /tmp/pr_comment.md << PR_EOF
404-
🚀 **Released in [${RELEASE_TAG}](${RELEASE_URL})**
405-
406-
Thank you for your contribution! 🙏
407-
408-
This is now available in the latest release. Please test and verify everything works as expected in your environment.
409-
410-
If you encounter any issues, please open a new issue.
411-
PR_EOF
412-
sed -i 's/^ //' /tmp/pr_comment.md
399+
# Add comment
400+
{
401+
echo "🚀 **Released in [${RELEASE_TAG}](${RELEASE_URL})**"
402+
echo ""
403+
echo "Thank you for your contribution! 🙏"
404+
echo ""
405+
echo "This is now available in the latest release. Please test and verify everything works as expected in your environment."
406+
echo ""
407+
echo "If you encounter any issues, please open a new issue."
408+
} > /tmp/pr_comment.md
413409
gh pr comment "$pr" --body-file /tmp/pr_comment.md 2>/dev/null || true
414410
415411
# Process linked issues
@@ -426,17 +422,16 @@ jobs:
426422
# Add label
427423
gh issue edit "$issue" --add-label "released:${RELEASE_TAG}" 2>/dev/null || true
428424
429-
# Add comment (use unquoted heredoc for natural variable expansion)
430-
cat > /tmp/issue_comment.md << ISSUE_EOF
431-
🚀 **Released in [${RELEASE_TAG}](${RELEASE_URL})**
432-
433-
Thank you for reporting this! 🙏
434-
435-
The fix/feature is now available in the latest release. Please update and verify everything works as expected.
436-
437-
If the issue persists or you find related problems, please open a new issue.
438-
ISSUE_EOF
439-
sed -i 's/^ //' /tmp/issue_comment.md
425+
# Add comment
426+
{
427+
echo "🚀 **Released in [${RELEASE_TAG}](${RELEASE_URL})**"
428+
echo ""
429+
echo "Thank you for reporting this! 🙏"
430+
echo ""
431+
echo "The fix/feature is now available in the latest release. Please update and verify everything works as expected."
432+
echo ""
433+
echo "If the issue persists or you find related problems, please open a new issue."
434+
} > /tmp/issue_comment.md
440435
gh issue comment "$issue" --body-file /tmp/issue_comment.md 2>/dev/null || true
441436
done
442437
done

0 commit comments

Comments
 (0)