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