From 1c3da22bcda8b3f2a3fd1e2f8c219565f741f221 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sat, 20 Jun 2026 10:29:42 +0200 Subject: [PATCH] fix(release): require exact publish child runs --- .../workflows/openclaw-release-publish.yml | 24 ++----------------- .../package-acceptance-workflow.test.ts | 5 ++++ 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/.github/workflows/openclaw-release-publish.yml b/.github/workflows/openclaw-release-publish.yml index b7a9ed594d6b..3d5d11fa52a4 100644 --- a/.github/workflows/openclaw-release-publish.yml +++ b/.github/workflows/openclaw-release-publish.yml @@ -519,12 +519,7 @@ jobs: local workflow="$1" shift - local before_json dispatch_output run_id - before_json="$(gh api -X GET "repos/${GITHUB_REPOSITORY}/actions/workflows/${workflow}/runs" \ - -F event=workflow_dispatch \ - -F per_page=100 \ - --jq '[.workflow_runs[].id]')" - + local dispatch_output run_id dispatch_output="$(gh workflow run --repo "$GITHUB_REPOSITORY" "$workflow" --ref "$workflow_ref" "$@" 2>&1)" printf '%s\n' "$dispatch_output" >&2 run_id="$( @@ -534,22 +529,7 @@ jobs: )" if [[ -z "$run_id" ]]; then - for _ in $(seq 1 60); do - run_id="$( - BEFORE_IDS="$before_json" gh api -X GET "repos/${GITHUB_REPOSITORY}/actions/workflows/${workflow}/runs" \ - -F event=workflow_dispatch \ - -F per_page=50 \ - --jq '.workflow_runs | map({databaseId:.id, createdAt:.created_at}) | map(select(.databaseId as $id | (env.BEFORE_IDS | fromjson | index($id) | not))) | sort_by(.createdAt) | reverse | .[0].databaseId // empty' - )" - if [[ -n "$run_id" ]]; then - break - fi - sleep 5 - done - fi - - if [[ -z "${run_id:-}" ]]; then - echo "Could not find dispatched run for ${workflow}." >&2 + echo "gh workflow run ${workflow} did not return an Actions run URL; refusing to guess from recent workflow_dispatch runs." >&2 exit 1 fi diff --git a/test/scripts/package-acceptance-workflow.test.ts b/test/scripts/package-acceptance-workflow.test.ts index b15ca02bf26f..4ab18bdcb8c6 100644 --- a/test/scripts/package-acceptance-workflow.test.ts +++ b/test/scripts/package-acceptance-workflow.test.ts @@ -2050,6 +2050,11 @@ describe("package artifact reuse", () => { expect(clawHubMetadataIndex).toBeGreaterThan(clawHubSetupIndex); expect(releaseWorkflow).toContain("Plugin npm run ID"); expect(releaseWorkflow).toContain("Plugin ClawHub run ID"); + expect(releaseWorkflow).toContain( + "did not return an Actions run URL; refusing to guess from recent workflow_dispatch runs", + ); + expect(releaseWorkflow).not.toContain("BEFORE_IDS="); + expect(releaseWorkflow).not.toContain("before_json"); expect(releaseWorkflow).toContain("plugin-clawhub-new.yml"); expect(releaseWorkflow).toContain("Plugin ClawHub bootstrap run ID"); expect(releaseWorkflow).toContain("scripts/openclaw-release-clawhub-plan.ts");