From 678d7400ed149e8b5263ee5e5285b37e21f7afa8 Mon Sep 17 00:00:00 2001 From: Ryan Hughes Date: Thu, 8 Oct 2026 15:16:31 -0400 Subject: [PATCH] Don't ask for a builder to rebuild what is already published (#870) The split in #869 sent every tree without an artifact to the rebuild job, so a dispatch whose x86 halves were already published waited eight minutes for eleven droplets that each found nothing to build in five seconds. Make the publish job's plan check in the changes job, on its hosted runner, before a builder is requested. --- .github/workflows/publish.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bbc3aaf..52bbc62 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -71,8 +71,17 @@ jobs: found=$(curl -fsS -H "Authorization: Bearer $GH_TOKEN" -H "Accept: application/vnd.github+json" \ "https://api.github.com/repos/${{ github.repository }}/actions/artifacts?name=$label&per_page=5" \ | jq -r '[.artifacts[] | select(.expired|not)] | sort_by(.created_at) | last | select(. != null) | "run \(.workflow_run.id), expires \(.expires_at)"') + # The plan the publish job makes, made here before a runner is + # asked for: a tree the channel already holds at master's version + # (a re-run, or a dispatch naming a package that is fine) needs + # no build, and an x86 rebuild would wait minutes for a droplet + # to find that out in seconds. + plan="" + [[ -n "$found" ]] || plan=$(bin/build --dry-run --mirror edge --arch "$arch" --package "$package" 2>&1 | grep -E '^==> Plan complete' || true) if [[ -n "$found" ]]; then decision="reuse the build artifact ($found)" + elif [[ -n "$plan" && -z "$(sed -E 's/.*would build: *//' <<<"$plan" | tr -d '[:space:]')" ]]; then + decision="already published at master's version, nothing to build" elif [[ $arch == aarch64 ]]; then decision="no build artifact: rebuild natively on ubuntu-24.04-arm" rebuild+=("$(jq -c '. + {runner: "[\"ubuntu-24.04-arm\"]"}' <<<"$entry")")