From cef4b39be33b5fa2ffc636d165edc98aa316a0e2 Mon Sep 17 00:00:00 2001 From: Tim Haines Date: Thu, 8 Oct 2026 13:58:28 -0500 Subject: [PATCH 1/4] Remove error check for empty status response If this action is triggered by a workflow that has only one event that creates a status (i.e., this action is the only one that creates a status) then this error check will always fail since there are no existing statuses for the commit hash. --- post-cdash-status | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/post-cdash-status b/post-cdash-status index d934700..9d98726 100755 --- a/post-cdash-status +++ b/post-cdash-status @@ -36,19 +36,7 @@ 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 -fi post_body="$(cat< Date: Thu, 8 Oct 2026 14:05:13 -0500 Subject: [PATCH 2/4] Simplify check for needed status update --- post-cdash-status | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/post-cdash-status b/post-cdash-status index 9d98726..3c01f01 100755 --- a/post-cdash-status +++ b/post-cdash-status @@ -38,6 +38,13 @@ readonly status_response=$( readonly statuses=$(jq -r '[.[].context] | @json' <<< $status_response) +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< Date: Thu, 8 Oct 2026 14:05:27 -0500 Subject: [PATCH 3/4] Update error return value --- post-cdash-status | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/post-cdash-status b/post-cdash-status index 3c01f01..a3883b4 100755 --- a/post-cdash-status +++ b/post-cdash-status @@ -68,5 +68,5 @@ readonly response=$( if [ "false" == $(jq -r 'has("creator")') <<<"$response" ]; then echo "Failed to create status for '${API_BASE}/commits/${COMMIT_SHA}'" echo -e "Request returned:\n$response" - exit 3 + exit 1 fi From 08e872e91910c84cabfbaf4b2dde7d2caa662402 Mon Sep 17 00:00:00 2001 From: Tim Haines Date: Thu, 8 Oct 2026 14:24:15 -0500 Subject: [PATCH 4/4] Properly quote creation status return value --- post-cdash-status | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/post-cdash-status b/post-cdash-status index a3883b4..ca523f9 100755 --- a/post-cdash-status +++ b/post-cdash-status @@ -65,7 +65,8 @@ readonly response=$( -H "X-GitHub-Api-Version: 2022-11-28" \ -d "${post_body}" "${post_url}") -if [ "false" == $(jq -r 'has("creator")') <<<"$response" ]; then +readonly created=$($(jq -r 'has("creator")') <<<"$response") +if [ "false" == "${created}" ]; then echo "Failed to create status for '${API_BASE}/commits/${COMMIT_SHA}'" echo -e "Request returned:\n$response" exit 1