Skip to content

Fix: Use heredoc syntax for multi-line GITHUB_OUTPUT in release workflow#166

Merged
jasonsiders merged 1 commit intomainfrom
fix/release-fix
Mar 16, 2026
Merged

Fix: Use heredoc syntax for multi-line GITHUB_OUTPUT in release workflow#166
jasonsiders merged 1 commit intomainfrom
fix/release-fix

Conversation

@jasonsiders
Copy link
Copy Markdown
Owner

The release workflow was failing when multiple packages were detected because the packages output was written using the simple key=value format, which doesn't support multi-line values. GitHub Actions was rejecting the pretty-printed JSON array with the error Invalid format ' {'.

The fix switches to the heredoc delimiter syntax (key<<EOF ... EOF) for writing to $GITHUB_OUTPUT, which correctly handles multi-line strings. This was surfaced by the Repo Cleanup PR (#165), which triggered detection of two packages simultaneously.

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

✅ Static Analysis: Check Passed

Analyzed changed files, and found 0 potential violations. 0 meets or exceeds the set severity threshold: Info

⚫ 0 Critical severity violation(s)
🔴 0 High severity violation(s)
🟠 0 Medium severity violation(s)
🟡 0 Low severity violation(s)
⚪ 0 Info severity violation(s)

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 16, 2026

Claude finished @jasonsiders's task —— View job


Pull Request Review ✅

Tasks:

  • Read repository guidelines (CLAUDE.md) - No repo-specific guidelines found
  • Examine the workflow file changes
  • Analyze code quality and best practices
  • Check for potential bugs or issues
  • Evaluate performance considerations
  • Review security concerns
  • Assess test coverage implications
  • Provide comprehensive feedback

Review Feedback

✅ Code Quality and Best Practices

The fix correctly addresses the GitHub Actions limitation with multi-line output values. The solution follows GitHub Actions best practices:

  • Proper heredoc syntax: Using <<EOF delimiter is the correct approach for multi-line output
  • Clean implementation: The block structure { ... } >> "$GITHUB_OUTPUT" is well-formatted and readable
  • Maintains functionality: The change preserves the existing logic while fixing the output format issue

✅ Bug Fix Analysis

This is a solid fix for a real issue:

  • Root cause identified: GitHub Actions rejects multi-line values in simple key=value format
  • Appropriate solution: Heredoc syntax (key<<EOF) is the standard way to handle multi-line strings in GitHub Actions
  • Error pattern match: The fix addresses the specific Invalid format ' {' error mentioned in the PR description

The change from:

echo "packages=$PACKAGES" >> "$GITHUB_OUTPUT"

To:

{
  echo 'packages<<EOF'
  echo "$PACKAGES"
  echo 'EOF'
} >> "$GITHUB_OUTPUT"

Is exactly what's needed for multi-line JSON output.

✅ Performance Considerations

  • No performance impact: The change is purely syntactical for output formatting
  • Same computational complexity: JSON processing and variable assignment remain unchanged
  • Minimal overhead: The heredoc approach has negligible performance difference

✅ Security Concerns

  • No security risks introduced: The change only affects output formatting
  • Input sanitization unchanged: JSON parsing and variable handling remain the same
  • No injection vulnerabilities: The heredoc delimiter (EOF) is static and safe

✅ Test Coverage

  • Workflow logic unchanged: The core package detection and JSON building logic remains identical
  • Output format preserved: The JSON array format sent to dependent jobs is unchanged
  • Integration testing: The fix resolves the workflow failure, which serves as integration validation

📋 Additional Observations

  1. Good timing: This fix was surfaced by the Repo Cleanup PR (Repo Cleanup #165) detecting multiple packages simultaneously - good catch!

  2. Consistent with GitHub Actions docs: The heredoc approach aligns with GitHub's official documentation for multi-line outputs

  3. No breaking changes: Downstream jobs consuming packages output will receive the same JSON format

✅ Overall Assessment

This is a well-targeted fix that solves a specific GitHub Actions limitation without introducing any side effects. The implementation follows best practices and maintains the existing functionality. The PR is ready for merge.

Recommendation: Approve


@jasonsiders jasonsiders merged commit c293cb2 into main Mar 16, 2026
4 checks passed
@jasonsiders jasonsiders deleted the fix/release-fix branch March 16, 2026 14:50
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.

1 participant