|
6 | 6 | - "v*.*.*" |
7 | 7 |
|
8 | 8 | jobs: |
| 9 | + # GATE — block build/publish/release until the required CI workflows pass |
| 10 | + # on this exact tagged commit. Polls the Actions API; a workflow that |
| 11 | + # concludes in any non-success terminal state aborts the whole pipeline. |
| 12 | + # (CI_DOES_THE_RELEASE, 2026-07-16 — matches the same fix applied to the |
| 13 | + # Python CLI repo after v10.12.2 shipped to PyPI with broken metadata |
| 14 | + # while its own CI test job was still failing on that commit.) |
| 15 | + require_ci_green: |
| 16 | + name: Require CI to pass on this commit |
| 17 | + runs-on: ubuntu-latest |
| 18 | + permissions: |
| 19 | + actions: read |
| 20 | + steps: |
| 21 | + - name: Poll required workflows |
| 22 | + env: |
| 23 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 24 | + SHA: ${{ github.sha }} |
| 25 | + REQUIRED: "ci.yml codeql.yml secret-scan.yml" |
| 26 | + run: | |
| 27 | + deadline=$(( $(date +%s) + 2400 )) # 40 min ceiling |
| 28 | + while :; do |
| 29 | + pending="" |
| 30 | + for wf in $REQUIRED; do |
| 31 | + out=$(gh run list --repo "$GITHUB_REPOSITORY" --workflow "$wf" \ |
| 32 | + --commit "$SHA" --limit 1 \ |
| 33 | + --json conclusion,status \ |
| 34 | + --jq '.[0] | (.conclusion // "none") + " " + (.status // "none")' \ |
| 35 | + 2>/dev/null || true) |
| 36 | + [ -z "$out" ] && out="none none" |
| 37 | + concl=${out%% *} |
| 38 | + echo " $wf -> conclusion=$concl" |
| 39 | + case "$concl" in |
| 40 | + success) ;; |
| 41 | + failure|cancelled|timed_out|startup_failure|action_required) |
| 42 | + echo "::error::$wf concluded '$concl' on $SHA — refusing to publish" |
| 43 | + exit 1 ;; |
| 44 | + *) pending="$pending $wf" ;; |
| 45 | + esac |
| 46 | + done |
| 47 | + if [ -z "$pending" ]; then |
| 48 | + echo "All required CI workflows passed on $SHA." |
| 49 | + break |
| 50 | + fi |
| 51 | + if [ "$(date +%s)" -ge "$deadline" ]; then |
| 52 | + echo "::error::Timed out waiting for required CI:$pending" |
| 53 | + exit 1 |
| 54 | + fi |
| 55 | + echo "Waiting for:$pending" |
| 56 | + sleep 25 |
| 57 | + done |
| 58 | +
|
9 | 59 | build: |
10 | 60 | name: Build distribution |
| 61 | + needs: require_ci_green |
11 | 62 | runs-on: ubuntu-latest |
12 | 63 |
|
13 | 64 | steps: |
|
0 commit comments