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
19 changes: 12 additions & 7 deletions .github/actions/release-gate/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,19 @@ runs:
# there is nothing to gate on, so flag it rather than silently passing.
if ! [[ " $PR_LABELS " == *" run-tests "* ]]; then
post failure "Add the run-tests label so the test suites run."
exit 1
exit 0
fi

# Latest conclusion of each required summary check for the head commit.
# Conclusion of each required summary check for the head commit. A name
# can appear more than once on a SHA (e.g. a skipped run from one event
# plus a real run from another), so prefer the latest NON-skipped run and
# only fall back to a skipped one when that is all there is.
runs_json=$(gh api "repos/$REPO/commits/$HEAD_SHA/check-runs" --paginate 2>/dev/null || echo '{}')
state_of() {
printf '%s' "$runs_json" | jq -r --arg n "$1" \
'[.check_runs[] | select(.name == $n)] | last // {} | "\(.status // "missing")|\(.conclusion // "")"'
printf '%s' "$runs_json" | jq -r --arg n "$1" '
([.check_runs[] | select(.name == $n)] | sort_by(.completed_at // "")) as $all
| (($all | map(select(.conclusion != "skipped")) | last) // ($all | last) // {})
| "\(.status // "missing")|\(.conclusion // "")"'
}
pending=false; failed=false
for name in "stylelint, eslint, phpcs" "PHPUnit - Test Results Summary" "Playwright - Test Results Summary"; do
Expand All @@ -65,13 +70,13 @@ runs:

if [ "$failed" = true ]; then
post failure "Required CI checks are not all passing."
exit 1
exit 0
fi

# All required checks are green. Validate the release PR itself.
case "$BASE_REF" in
core|core-beta|pro|pro-beta) ;;
*) post failure "Base branch '$BASE_REF' must be core, core-beta, pro or pro-beta."; exit 1 ;;
*) post failure "Base branch '$BASE_REF' must be core, core-beta, pro or pro-beta."; exit 0 ;;
esac

# Parse the two "Release verification" checkboxes, fence-aware so text
Expand All @@ -90,7 +95,7 @@ runs:

if [ "$total" -ne 2 ] || [ "$checked" -ne 2 ]; then
post failure "Tick both release-verification checkboxes ($checked/$total approved)."
exit 1
exit 0
fi

post success "Required checks green and release verification approved."
Loading