File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -132,7 +132,9 @@ jobs:
132132 echo "$OUTPUT"
133133
134134 # Save to file for the finish job's PR comment.
135- printf '%s' "$OUTPUT" > /tmp/apply_output.md
135+ # printf '%s\n' ensures a trailing newline so GITHUB_ENV delimiter
136+ # parsing in the finish job always finds its closing marker on its own line.
137+ printf '%s\n' "$OUTPUT" > /tmp/apply_output.md
136138
137139 case "$EXIT_CODE" in
138140 0) echo "status=ok" >> "$GITHUB_OUTPUT" ;;
@@ -307,10 +309,14 @@ jobs:
307309 - name : Load apply output into environment
308310 run : |
309311 if [ -f /tmp/apply-output/apply_output.md ]; then
312+ # Use a random delimiter so the content can never accidentally contain it.
313+ # The explicit leading \n before the delimiter ensures it lands on its own
314+ # line even when the file was written without a trailing newline.
315+ DELIM="$(openssl rand -hex 16)"
310316 {
311- echo " apply_output<<APPLY_EOF "
317+ printf ' apply_output<<% s\n' "$DELIM "
312318 cat /tmp/apply-output/apply_output.md
313- echo "APPLY_EOF "
319+ printf '\n%s\n' "$DELIM "
314320 } >> "$GITHUB_ENV"
315321 fi
316322
You can’t perform that action at this time.
0 commit comments