diff --git a/.github/workflows/release-finalize.yml b/.github/workflows/release-finalize.yml index a460fbb..f62d4f5 100644 --- a/.github/workflows/release-finalize.yml +++ b/.github/workflows/release-finalize.yml @@ -23,7 +23,9 @@ jobs: resolve: if: >- github.repository == 'operatorstack/yield' && - (github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success') + (github.event_name == 'workflow_dispatch' || + (github.event.workflow_run.conclusion == 'success' && + github.event.workflow_run.event == 'workflow_dispatch')) runs-on: ubuntu-latest outputs: finalize: ${{ steps.release.outputs.finalize }} @@ -86,7 +88,7 @@ jobs: set -euo pipefail version="${TAG#v}" run="$(gh api "/repos/${GITHUB_REPOSITORY}/actions/workflows/npm-publish.yml/runs?head_sha=${SOURCE_SHA}&status=completed&per_page=30" \ - --jq '[.workflow_runs[] | select(.event == "workflow_run" or .event == "workflow_dispatch")][0] // {}')" + --jq '[.workflow_runs[] | select(.event == "workflow_dispatch")][0] // {}')" test "$(jq -r '.conclusion // "missing"' <<< "$run")" = success run_id="$(jq -r '.id // empty' <<< "$run")" test -n "$run_id" diff --git a/scripts/check-release-control.mjs b/scripts/check-release-control.mjs index dd9114c..29f73b0 100644 --- a/scripts/check-release-control.mjs +++ b/scripts/check-release-control.mjs @@ -93,6 +93,8 @@ export async function checkReleaseControl(root = resolve(import.meta.dirname, ". "receipt-complete finalization needs artifact read access and contents:write", ); expect(finalizer.jobs?.finalize?.needs === "resolve", "finalization must follow read-only tag resolution"); + expect(raw["release-finalize.yml"].includes("github.event.workflow_run.event == 'workflow_dispatch'"), "automatic finalization must ignore canary publisher runs"); + expect(raw["release-finalize.yml"].includes('select(.event == "workflow_dispatch")'), "finalization must select only stable publisher receipts"); expect(raw["release-finalize.yml"].includes("--draft=false"), "only the receipt finalizer may publish the GitHub release"); expect(raw["release-finalize.yml"].includes("npm-publish.yml"), "finalization must bind the combined publisher receipt"); expect(raw["release-finalize.yml"].includes("pypi-release.mjs verify"), "finalization must verify the PyPI wheel hashes");