Use jq to check array length

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Henry Mercer
2025-09-22 15:21:20 +01:00
committed by GitHub
parent 8a9ef89a8a
commit 33da5f0b36

View File

@@ -34,7 +34,7 @@ CHECKS="$(gh api repos/github/codeql-action/commits/"${GITHUB_SHA}"/check-runs -
echo "$CHECKS" | jq
# Fail if there are no checks
if [ -z "$CHECKS" ] || [ "$CHECKS" == "[]" ]; then
if [ -z "$CHECKS" ] || [ "$(echo "$CHECKS" | jq '. | length')" -eq 0 ]; then
echo "No checks found for $GITHUB_SHA"
exit 1
fi