diff --git a/post-cdash-status b/post-cdash-status index d934700..ca523f9 100755 --- a/post-cdash-status +++ b/post-cdash-status @@ -36,20 +36,15 @@ readonly status_response=$( -H "X-GitHub-Api-Version: 2022-11-28" \ "${API_BASE}/commits/${COMMIT_SHA}/statuses") -# The API returns an empty array if no statuses were found -# This can happen if the COMMIT_SHA doesn't point to the head of the branch/PR -if [ "true" == $(jq -r '. == []' <<<$status_response) ]; then - echo "No statuses found for '${API_BASE}/commits/${COMMIT_SHA}'" - exit 1 -fi - readonly statuses=$(jq -r '[.[].context] | @json' <<< $status_response) -if [ -z "$statuses" ]; then - echo "Failed to parse statuses for '${API_BASE}/commits/${COMMIT_SHA}'" - echo -e "Request returned:\n$status_response" - exit 2 + +if [ "true" != $(jq -re "all(. != \"${GITHUB_STATUS_NAME}\")" <<<"${statuses}") ]; then + echo "No status updates needed." + exit 0; fi +echo "Need to post a status for context ${GITHUB_STATUS_NAME}" + post_body="$(cat<