@@ -57,37 +57,53 @@ while IFS= read -r version || [[ -n "$version" ]]; do
5757
5858 echo " Checking CI for $version_name (commit: $commit_hash )..."
5959
60- # Check combined commit status
61- status= $( gh api " /repos/${FIRECRACKER_REPO_API} /commits/${commit_hash} /status" --jq ' .state' 2> /dev/null || echo " unknown" )
60+ # Check combined commit status (returns total_count of statuses)
61+ status_response= $( gh api " /repos/${FIRECRACKER_REPO_API} /commits/${commit_hash} /status" 2> /dev/null || echo ' {"state":"unknown","total_count":0}' )
62+ status= $( echo " $status_response " | jq -r ' .state' )
63+ status_count= $( echo " $status_response " | jq -r ' .total_count' )
6264
6365 # Check check-runs (GitHub Actions)
6466 # Order matters: check pending BEFORE success (null conclusion means in-progress)
65- check_conclusion= $( gh api " /repos/${FIRECRACKER_REPO_API} /commits/${commit_hash} /check-runs" --jq '
67+ check_response= $( gh api " /repos/${FIRECRACKER_REPO_API} /commits/${commit_hash} /check-runs" 2> /dev/null || echo ' {"total_count":0}' )
68+ check_count= $( echo " $check_response " | jq -r ' .total_count' )
69+ check_conclusion= $( echo " $check_response " | jq -r '
6670 if .total_count == 0 then "no_checks"
6771 elif ([.check_runs[].status] | any(. == "in_progress" or . == "queued")) then "pending"
6872 elif ([.check_runs[].conclusion] | any(. == "failure" or . == "cancelled" or . == "timed_out")) then "failure"
6973 elif ([.check_runs[].conclusion] | all(. == "success" or . == "skipped" or . == "neutral")) then "success"
7074 else "unknown"
7175 end
72- ' 2> /dev/null || echo " unknown " )
76+ ' )
7377
74- echo " Status: $status , Check runs: $check_conclusion "
78+ echo " Status: $status (count: $status_count ) , Check runs: $check_conclusion (count: $check_count ) "
7579
76- # Treat unknown as failure (API errors should block release)
80+ # Handle the different cases
7781 if [[ " $status " == " failure" ]] || [[ " $check_conclusion " == " failure" ]]; then
7882 echo " ❌ CI failed for $version_name "
7983 all_passed=false
8084 failed_versions=" ${failed_versions}${version_name} "
81- elif [[ " $status " == " pending" ]] || [[ " $check_conclusion " == " pending" ]]; then
85+ elif [[ " $check_conclusion " == " pending" ]]; then
86+ # Only pending if there are actual check-runs in progress
8287 echo " ⏳ CI still running for $version_name "
8388 all_passed=false
8489 failed_versions=" ${failed_versions}${version_name} (pending) "
85- elif [[ " $status " == " unknown" ]] || [[ " $check_conclusion " == " unknown" ]]; then
90+ elif [[ " $status " == " pending" ]] && [[ " $status_count " -gt 0 ]]; then
91+ # Only pending if there are actual statuses pending
92+ echo " ⏳ CI still running for $version_name "
93+ all_passed=false
94+ failed_versions=" ${failed_versions}${version_name} (pending) "
95+ elif [[ " $status " == " unknown" ]] && [[ " $check_conclusion " == " unknown" ]]; then
8696 echo " ⚠️ Could not verify CI status for $version_name (API error)"
8797 all_passed=false
8898 failed_versions=" ${failed_versions}${version_name} (unknown) "
8999 elif [[ " $status " == " success" ]] || [[ " $check_conclusion " == " success" ]]; then
90100 echo " ✅ CI passed for $version_name "
101+ elif [[ " $status_count " -eq 0 ]] && [[ " $check_count " -eq 0 ]]; then
102+ # No CI configured for this commit - treat as acceptable
103+ echo " ℹ️ No CI checks found for $version_name (assuming OK)"
104+ elif [[ " $status " == " pending" ]] && [[ " $status_count " -eq 0 ]] && [[ " $check_conclusion " == " no_checks" ]]; then
105+ # GitHub returns "pending" when there are no statuses - this is OK
106+ echo " ℹ️ No CI checks found for $version_name (assuming OK)"
91107 else
92108 # Catch-all for unexpected states
93109 echo " ⚠️ Unexpected CI state for $version_name : status=$status , check_conclusion=$check_conclusion "
0 commit comments