Skip to content

Commit f152daf

Browse files
committed
github-actions: fix YAML parse error in lt-rebase-merge heredocs
Heredocs (<<EOF...EOF) inside YAML run: | blocks had their EOF terminators at column 1, which the YAML parser interprets as ending the block scalar. This caused the entire workflow file to fail parsing, silently preventing issue_comment events from triggering the workflow since commit a4bd60a. Replace --body-file heredocs with --body using shell variables, which avoids the YAML indentation conflict entirely. Signed-off-by: Brett Mastbergen <bmastbergen@ciq.com>
1 parent 1d8499f commit f152daf

1 file changed

Lines changed: 12 additions & 30 deletions

File tree

.github/workflows/lt-rebase-merge.yml

Lines changed: 12 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -254,11 +254,8 @@ jobs:
254254
for pr in $OPEN_PRS; do
255255
echo "Parking PR #$pr on ${TEMP_BRANCH}"
256256
gh pr edit "$pr" --repo "$REPOSITORY" --base "${TEMP_BRANCH}"
257-
gh pr comment "$pr" --repo "$REPOSITORY" --body-file - <<EOF || true
258-
:hourglass_flowing_sand: A rebase of \`${TARGET_BRANCH}\` to the latest upstream stable release is in progress. This PR has been temporarily moved to \`${TEMP_BRANCH}\` while the branch is updated.
259-
260-
Workflow run: ${RUN_URL}
261-
EOF
257+
printf -v COMMENT_BODY ':hourglass_flowing_sand: A rebase of `%s` to the latest upstream stable release is in progress. This PR has been temporarily moved to `%s` while the branch is updated.\n\nWorkflow run: %s' "$TARGET_BRANCH" "$TEMP_BRANCH" "$RUN_URL"
258+
gh pr comment "$pr" --repo "$REPOSITORY" --body "$COMMENT_BODY" || true
262259
done
263260
264261
- name: Setup branch references and execute lt_rebase_merge.sh
@@ -327,19 +324,13 @@ EOF
327324
echo "Retargeting PR #$pr to ${TARGET_BRANCH}"
328325
if ! gh pr edit "$pr" --repo "$REPOSITORY" --base "${TARGET_BRANCH}"; then
329326
echo "❌ Failed to retarget PR #$pr"
330-
gh pr comment "$pr" --repo "$REPOSITORY" --body-file - <<EOF || true
331-
:warning: Failed to retarget this PR back to \`${TARGET_BRANCH}\` after rebase. This PR may still be on temporary branch \`${TEMP_BRANCH}\`. Please manually update the base branch.
332-
333-
Workflow run: ${RUN_URL}
334-
EOF
327+
printf -v COMMENT_BODY ':warning: Failed to retarget this PR back to `%s` after rebase. This PR may still be on temporary branch `%s`. Please manually update the base branch.\n\nWorkflow run: %s' "$TARGET_BRANCH" "$TEMP_BRANCH" "$RUN_URL"
328+
gh pr comment "$pr" --repo "$REPOSITORY" --body "$COMMENT_BODY" || true
335329
RESTORE_FAILURES=$((RESTORE_FAILURES + 1))
336330
continue
337331
fi
338-
gh pr comment "$pr" --repo "$REPOSITORY" --body-file - <<EOF || true
339-
:white_check_mark: \`${TARGET_BRANCH}\` has been rebased to \`${NEW_VERSION}\`. This PR has been retargeted to the updated branch. You will need to rebase your PR branch onto the new \`${TARGET_BRANCH}\`.
340-
341-
Workflow run: ${RUN_URL}
342-
EOF
332+
printf -v COMMENT_BODY ':white_check_mark: `%s` has been rebased to `%s`. This PR has been retargeted to the updated branch. You will need to rebase your PR branch onto the new `%s`.\n\nWorkflow run: %s' "$TARGET_BRANCH" "$NEW_VERSION" "$TARGET_BRANCH" "$RUN_URL"
333+
gh pr comment "$pr" --repo "$REPOSITORY" --body "$COMMENT_BODY" || true
343334
done
344335
345336
if [ "$RESTORE_FAILURES" -gt 0 ]; then
@@ -356,19 +347,13 @@ EOF
356347
echo "Restoring PR #$pr to ${TARGET_BRANCH}"
357348
if ! gh pr edit "$pr" --repo "$REPOSITORY" --base "${TARGET_BRANCH}"; then
358349
echo "❌ Failed to restore PR #$pr"
359-
gh pr comment "$pr" --repo "$REPOSITORY" --body-file - <<EOF || true
360-
:warning: Failed to move this PR back to \`${TARGET_BRANCH}\`. This PR may still be on temporary branch \`${TEMP_BRANCH}\`. Please manually update the base branch.
361-
362-
Workflow run: ${RUN_URL}
363-
EOF
350+
printf -v COMMENT_BODY ':warning: Failed to move this PR back to `%s`. This PR may still be on temporary branch `%s`. Please manually update the base branch.\n\nWorkflow run: %s' "$TARGET_BRANCH" "$TEMP_BRANCH" "$RUN_URL"
351+
gh pr comment "$pr" --repo "$REPOSITORY" --body "$COMMENT_BODY" || true
364352
RESTORE_FAILURES=$((RESTORE_FAILURES + 1))
365353
continue
366354
fi
367-
gh pr comment "$pr" --repo "$REPOSITORY" --body-file - <<EOF || true
368-
:warning: The rebase of \`${TARGET_BRANCH}\` could not proceed. This PR has been moved back to \`${TARGET_BRANCH}\`. No changes were made to the branch.
369-
370-
Workflow run: ${RUN_URL}
371-
EOF
355+
printf -v COMMENT_BODY ':warning: The rebase of `%s` could not proceed. This PR has been moved back to `%s`. No changes were made to the branch.\n\nWorkflow run: %s' "$TARGET_BRANCH" "$TARGET_BRANCH" "$RUN_URL"
356+
gh pr comment "$pr" --repo "$REPOSITORY" --body "$COMMENT_BODY" || true
372357
done
373358
374359
if [ "$RESTORE_FAILURES" -gt 0 ]; then
@@ -382,11 +367,8 @@ EOF
382367
# Script ran and failed — TARGET_BRANCH may be in unknown state, don't move PRs
383368
echo "⚠️ Rebase merge failed, leaving PRs on ${TEMP_BRANCH}"
384369
for pr in $PARKED_PRS; do
385-
gh pr comment "$pr" --repo "$REPOSITORY" --body-file - <<EOF || true
386-
:warning: The rebase of \`${TARGET_BRANCH}\` failed. This PR remains on temporary branch \`${TEMP_BRANCH}\` to prevent it from being closed. The kernel team is investigating the failure.
387-
388-
Workflow run: ${RUN_URL}
389-
EOF
370+
printf -v COMMENT_BODY ':warning: The rebase of `%s` failed. This PR remains on temporary branch `%s` to prevent it from being closed. The kernel team is investigating the failure.\n\nWorkflow run: %s' "$TARGET_BRANCH" "$TEMP_BRANCH" "$RUN_URL"
371+
gh pr comment "$pr" --repo "$REPOSITORY" --body "$COMMENT_BODY" || true
390372
done
391373
fi
392374

0 commit comments

Comments
 (0)