Skip to content

fix: Multiline output encoding (EOF syntax)#5

Merged
milhul6 merged 1 commit intomainfrom
fix/escape-multiline-output
Oct 10, 2025
Merged

fix: Multiline output encoding (EOF syntax)#5
milhul6 merged 1 commit intomainfrom
fix/escape-multiline-output

Conversation

@milhul6
Copy link
Copy Markdown
Contributor

@milhul6 milhul6 commented Oct 10, 2025

User description

Fix

Resolve GITHUB_OUTPUT parse error for multiline PR body.

Problem

Error: Unable to process file command 'output' successfully.
Error: Invalid format '## Purpose'

Root cause: PR body with markdown headers (## Purpose) triggers parse error in GITHUB_OUTPUT when using simple assignment.

Solution

Use heredoc EOF syntax per GitHub Actions docs:

{
  echo "key<<EOF"
  echo "$MULTILINE_VALUE"
  echo "EOF"
} >> "$GITHUB_OUTPUT"

Why This Is THE Final Fix

✅ Handles markdown headers
✅ Handles special chars
✅ GitHub Actions official pattern
✅ Tested on PR body with ## headers


This unblocks end-to-end workflow execution!


PR Type

Bug fix


Description

  • Fix multiline output encoding using EOF syntax

  • Resolve GITHUB_OUTPUT parse error for PR bodies

  • Handle markdown headers and special characters properly

  • Use GitHub Actions official heredoc pattern


Diagram Walkthrough

flowchart LR
  A["PR metadata fetch"] --> B["Simple assignment"] 
  B --> C["Parse error with markdown"]
  A --> D["EOF heredoc syntax"]
  D --> E["Successful multiline handling"]
Loading

File Walkthrough

Relevant files
Bug fix
claude-pr-assistant.yml
Implement EOF syntax for multiline outputs                             

.github/workflows/claude-pr-assistant.yml

  • Replace simple variable assignment with EOF heredoc syntax
  • Wrap PR title and body output in multiline string blocks
  • Add proper delimiter handling for GitHub Actions output
+10/-2   

Note

Use heredoc (<<EOF) for PR title/body outputs in the workflow to correctly handle multiline PR metadata.

  • Workflows:
    • Update .github/workflows/claude-pr-assistant.yml to write PR metadata outputs (title, body) to GITHUB_OUTPUT using heredoc <<EOF syntax to support multiline values and avoid parse errors.

Written by Cursor Bugbot for commit 5904855. This will update automatically on new commits. Configure here.

Problem: PR body with markdown headers causes GITHUB_OUTPUT parse error.
Error: Invalid format '## Purpose'

Solution: Use heredoc syntax (EOF delimiter) for multiline values:
  echo "key<<EOF"
  echo "$VALUE"
  echo "EOF"

Ref: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@milhul6 milhul6 merged commit 5654deb into main Oct 10, 2025
1 check passed
@codiumai-pr-agent-free
Copy link
Copy Markdown
Contributor

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🎫 No ticket provided
  • Create ticket/issue
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
No custom compliance provided

Follow the guide to enable custom compliance check.

Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@codiumai-pr-agent-free
Copy link
Copy Markdown
Contributor

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Use random delimiters for multiline output

Use a randomized delimiter instead of the static EOF for setting multiline
GitHub Actions outputs. This prevents potential output corruption if the PR
title or body contains the delimiter string.

.github/workflows/claude-pr-assistant.yml [145-153]

 # GitHub Actions multiline string syntax
+DELIMITER_TITLE=$(openssl rand -hex 8)
 {
-  echo "title<<EOF"
+  echo "title<<$DELIMITER_TITLE"
   echo "$PR_TITLE"
-  echo "EOF"
-  echo "body<<EOF"
-  echo "$PR_BODY"
-  echo "EOF"
+  echo "$DELIMITER_TITLE"
 } >> "$GITHUB_OUTPUT"
 
+DELIMITER_BODY=$(openssl rand -hex 8)
+{
+  echo "body<<$DELIMITER_BODY"
+  echo "$PR_BODY"
+  echo "$DELIMITER_BODY"
+} >> "$GITHUB_OUTPUT"
+
  • Apply / Chat
Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies a potential bug where the static EOF delimiter could appear in the PR content, leading to corrupted output. Using a random delimiter is a best practice that makes the workflow more robust.

Medium
  • More

echo "body<<EOF"
echo "$PR_BODY"
echo "EOF"
} >> "$GITHUB_OUTPUT"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bug: GITHUB_OUTPUT Parsing Fails on EOF Delimiter

The hardcoded EOF delimiter for GITHUB_OUTPUT variables title and body can cause premature termination if the PR title or body content contains EOF on its own line. This leads to incorrect parsing of the output variables and breaks the workflow.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant