fix(ci): readiness gate was packing multi-line body into a single read#75
Merged
Merged
Conversation
Previous form:
read -r body base_ref state <<<"$(gh api ... --jq '"\(.body // "")\t\(.base.ref)\t\(.state)"')"
PR bodies are multi-line and the marker is itself space-separated. read
defaults to whitespace IFS and only consumes through the first newline,
so a body starting with 'Client PR: #2059\n...' assigned:
body = 'Client'
base_ref = 'PR:'
state = '#2059'
The gate then hit the early-return:
if [ "$state" != "open" ] && [ "$state" != "OPEN" ]; then
echo "PR #$PR_NUM is $state — skipping."
exit 0
fi
…and exited with the visible-in-the-job 'PR #25 is #2059 — skipping.',
never posting the linked-client-pr-ready custom status. The job logged
'success' because exit 0 is what the early-return does, but the
readiness verdict never reached the commit.
Fix:
- body = separate gh api call (multi-line tolerated naturally)
- base_ref + state packed into a tab-separated single-line, read with
IFS=$'\t' so a hypothetical future whitespace in either field
wouldn't repeat the bug
- Same IFS=$'\t' added to the second read of (merged, merge_commit_sha)
for consistency, even though neither field can contain whitespace
today
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Followup to #73. The gate's
read -r body base_ref state <<<...was reading only through the first newline of the multi-line PR body, then splitting on whitespace IFS — so a body starting with 'Client PR: #2059' assigned body='Client', base_ref='PR:', state='#2059'. State '#2059' isn't 'open' → the gate exited early with 'PR is #2059 — skipping.' and never posted the readiness status.Fix: extract body separately (multi-line tolerated), pack base_ref + state alone with IFS=$'\t'.