Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,26 @@ if [ "$(git rev-parse HEAD)" != "$(git rev-parse origin/main)" ]; then
exit 1
fi

# ── Verify CI passed on HEAD ─────────────────────────────────────────────────

HEAD_SHA=$(git rev-parse HEAD)
echo "Checking CI status for $(git rev-parse --short HEAD)..."
CI_STATE=$(gh api "repos/oasdiff/oasdiff-action/commits/${HEAD_SHA}/status" --jq '.state' 2>/dev/null || echo "unknown")
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")

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

echo "✓ CI passed on HEAD"

# ── Tag ──────────────────────────────────────────────────────────────────────

git tag "$NEW"
Expand Down
Loading