From 5c393da922c0924ce47453ba5059a6b54bb57067 Mon Sep 17 00:00:00 2001 From: Rod Vince Date: Fri, 20 Nov 2026 05:11:38 -0600 Subject: [PATCH] ci: invoke release guard with the published tag Bind the automatic publisher to the reusable guard and exclude its own run without changing the historical timeout policy. Greenhouse evidence/1237; reference Runtime #839. --- .github/workflows/release-guard.yml | 15 +++++++++++---- .github/workflows/release.yml | 16 ++++++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-guard.yml b/.github/workflows/release-guard.yml index 446ced7..4de53bc 100644 --- a/.github/workflows/release-guard.yml +++ b/.github/workflows/release-guard.yml @@ -17,6 +17,12 @@ name: Release guard on: release: types: [published] + workflow_call: + inputs: + tag_name: + description: The exact tag returned by the release publisher + required: true + type: string permissions: contents: write @@ -31,7 +37,7 @@ jobs: - name: Is the tagged commit green? env: GH_TOKEN: ${{ github.token }} - TAG: ${{ github.event.release.tag_name }} + TAG: ${{ inputs.tag_name || github.event.release.tag_name }} REPO: ${{ github.repository }} run: | set -uo pipefail @@ -56,8 +62,9 @@ jobs: # Relevant checks, and whether the page holds all of them. Checks from this run are excluded. # Workflow runs on the same commit that have not finished: a job that runs after another one - # creates its check late, so nothing is judged while its workflow is still going. Runs started - # by a release are left out; they are guards like this one, not tests of the tree. + # creates its check late, so nothing is judged while its workflow is still going. Preserve + # the existing release-event exemption: those runs are guards, not tests of the tree. + # Also exclude this exact run ID; a reusable call shares the publisher's push run ID. if [ -n "$sha" ] \ && counts=$(gh api "repos/$REPO/commits/$sha/check-runs?per_page=100" -q ' def relevant: @@ -73,7 +80,7 @@ jobs: ] | map(tostring) | join(" ")') \ && runs=$(gh api "repos/$REPO/actions/runs?head_sha=$sha&per_page=100" -q ' [ - ([.workflow_runs[] | select(.event != "release") | select(.status != "completed")] | length), + ([.workflow_runs[] | select(.event != "release") | select(.id != (env.GITHUB_RUN_ID | tonumber)) | select(.status != "completed")] | length), (if .total_count == (.workflow_runs | length) then "all" else "partial" end) ] | map(tostring) | join(" ")') \ && [[ "$counts" =~ ^[0-9]+\ [0-9]+\ [0-9]+\ [0-9]+\ [0-9]+\ all$ ]] \ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 234ca9c..136a005 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,8 +20,24 @@ permissions: jobs: release-please: runs-on: ubuntu-latest + outputs: + release_created: ${{ steps.release.outputs.release_created }} + tag_name: ${{ steps.release.outputs.tag_name }} steps: - uses: googleapis/release-please-action@v4 + id: release with: config-file: .github/release-please-config.json manifest-file: .github/.release-please-manifest.json + + release-guard: + needs: release-please + if: needs.release-please.outputs.release_created == 'true' + permissions: + contents: write + issues: write + actions: read + checks: read + uses: ./.github/workflows/release-guard.yml + with: + tag_name: ${{ needs.release-please.outputs.tag_name }}