ci: ensure block pr scan always returns valid json

Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
Rachel Powers 2025-03-12 15:21:08 -07:00
parent a2907dcaa3
commit a6a172a136
No known key found for this signature in database
GPG Key ID: E10E321EB160949B

View File

@ -44,7 +44,7 @@ jobs:
"prHeadSha": .head.sha, "prHeadSha": .head.sha,
"prHeadLabel": .head.label, "prHeadLabel": .head.label,
"prBody": .body, "prBody": .body,
"prLabels": reduce .labels[].name as $l ([]; . + [$l]) "prLabels": (reduce .labels[].name as $l ([]; . + [$l]))
} }
' <<< "$PR_JSON")" ' <<< "$PR_JSON")"
} >> "$GITHUB_ENV" } >> "$GITHUB_ENV"
@ -80,7 +80,7 @@ jobs:
"prHeadSha": .head.sha, "prHeadSha": .head.sha,
"prHeadLabel": .head.label, "prHeadLabel": .head.label,
"prBody": .body, "prBody": .body,
"prLabels": reduce .labels[].name as $l ([]; . + [$l]) "prLabels": (reduce .labels[].name as $l ([]; . + [$l]))
} }
' <<< "$PR_JSON")" ' <<< "$PR_JSON")"
} >> "$GITHUB_ENV" } >> "$GITHUB_ENV"
@ -93,18 +93,24 @@ jobs:
jq ' jq '
.prBody as $body .prBody as $body
| ( | (
$body | scan("blocked (?(?by)|(?on)):? #(?<num>[0-9]+)") $body |
| map({ reduce (
"type": "Blocked on", . | scan("blocked (?:by|on):? #([0-9]+)")
"number": ( . | tonumber ) | map({
}) "type": "Blocked on",
"number": ( . | tonumber )
})
) as $i ([]; . + [$i])
) as $bprs ) as $bprs
| ( | (
$body | scan("stacked on:? #(?<num>[0-9]+)") $body |
| map({ reduce (
"type": "Stacked on", . | scan("stacked on:? #([0-9]+)")
"number": ( . | tonumber ) | map({
}) "type": "Stacked on",
"number": ( . | tonumber )
})
) as $i ([]; . + [$i])
) as $sprs ) as $sprs
| ($bprs + $sprs) as $prs | ($bprs + $sprs) as $prs
| { | {