Skip to content

Commit ee78a59

Browse files
fix: check failure before pending in CI status check
When a repo uses only GitHub Actions (check-runs) and not commit statuses, the status API returns "pending" by default. Checking pending first would prompt unnecessarily even when all check-runs passed. Check failure first so the pending branch only triggers when status is genuinely unknown. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7e05c07 commit ee78a59

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

release.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ echo "Checking CI status for $(git rev-parse --short HEAD)..."
7777
CI_STATE=$(gh api "repos/oasdiff/oasdiff-action/commits/${HEAD_SHA}/status" --jq '.state' 2>/dev/null || echo "unknown")
7878
CI_CHECKS=$(gh api "repos/oasdiff/oasdiff-action/commits/${HEAD_SHA}/check-runs" --jq '[.check_runs[] | select(.conclusion != "success" and .conclusion != "skipped" and .conclusion != null)] | length' 2>/dev/null || echo "unknown")
7979

80-
if [ "$CI_STATE" = "pending" ] || [ "$CI_CHECKS" = "unknown" ]; then
80+
if [ "$CI_STATE" = "failure" ] || [ "$CI_CHECKS" != "0" ]; then
81+
echo "error: CI checks failed on HEAD — fix tests before releasing" >&2
82+
echo " See: https://github.com/oasdiff/oasdiff-action/actions" >&2
83+
exit 1
84+
elif [ "$CI_STATE" = "pending" ] || [ "$CI_CHECKS" = "unknown" ]; then
8185
echo "warning: CI status is pending or unknown — tests may not have run yet" >&2
8286
printf "Continue anyway? [y/N] "
8387
read -r answer
8488
case "$answer" in [yY]*) ;; *) echo "Aborted."; exit 1 ;; esac
85-
elif [ "$CI_STATE" = "failure" ] || [ "$CI_CHECKS" != "0" ]; then
86-
echo "error: CI checks failed on HEAD — fix tests before releasing" >&2
87-
echo " See: https://github.com/oasdiff/oasdiff-action/actions" >&2
88-
exit 1
8989
fi
9090

9191
echo "✓ CI passed on HEAD"

0 commit comments

Comments
 (0)