diff --git a/scripts/priority-gate.sh b/scripts/priority-gate.sh index 14eebdef5..88f255231 100755 --- a/scripts/priority-gate.sh +++ b/scripts/priority-gate.sh @@ -22,11 +22,12 @@ API_BASE="https://git.infra.mintel.me/api/v1/repos/$GITHUB_REPOSITORY/actions/ru LIMIT=50 RESPONSE=$(curl -s -H "Authorization: token $GITEA_PAT" "$API_BASE?limit=$LIMIT") -# Verify response is valid JSON -if ! echo "$RESPONSE" | jq empty 2>/dev/null; then - echo "Failed to parse API response from Gitea." +# Verify response is a valid JSON array +if ! echo "$RESPONSE" | jq -e 'type == "array"' >/dev/null 2>&1; then + echo "Failed to parse API response from Gitea (not an array) or API error." echo "$RESPONSE" - exit 1 + echo "Bypassing priority gate gracefully." + exit 0 fi # Use jq to extract running or waiting jobs that are NOT the current one