From 833986a4c3590fde31176842086ed7712fedd8e6 Mon Sep 17 00:00:00 2001 From: Michael Oliver Date: Wed, 14 Oct 2026 12:26:35 -0700 Subject: [PATCH 1/2] ci(dev-build): recreate the dev-build tag instead of moving it GITHUB_TOKEN can't update a ref across commits that change .github/workflows, so the PATCH that moved the dev-build tag failed with "Resource not accessible by integration" whenever a workflow had changed since the last dev build (ab7579e1, after #129 changed homebrew-canary.yml). The release had already been deleted, so no dev-build release was left. Delete the tag and let `gh release create --target` create it on this commit instead. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Michael Oliver --- .github/workflows/dev-build.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index 6c02fae6..f4799ae9 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -519,13 +519,13 @@ jobs: gh release delete "$tag" --yes --cleanup-tag=false || true fi - # Point the rolling tag at this commit. `gh release create --target` only applies when it - # creates the tag, so an existing tag stayed on its original commit. GitHub orders releases by - # the tagged commit's date, which kept the pre-release below newer stable releases. + # Point the rolling tag at this commit by deleting it and letting `gh release create --target` + # create it again (`--target` is ignored when the tag already exists, and GitHub orders releases by + # the tagged commit's date). Don't move it with a PATCH: GITHUB_TOKEN can't update a ref across + # commits that change .github/workflows, so every build after a workflow change failed with + # "Resource not accessible by integration" after the release was already deleted. if gh api "repos/${GITHUB_REPOSITORY}/git/refs/tags/${tag}" >/dev/null 2>&1; then - gh api -X PATCH "repos/${GITHUB_REPOSITORY}/git/refs/tags/${tag}" -f sha="$GITHUB_SHA" -F force=true >/dev/null - else - gh api -X POST "repos/${GITHUB_REPOSITORY}/git/refs" -f ref="refs/tags/${tag}" -f sha="$GITHUB_SHA" >/dev/null + gh api -X DELETE "repos/${GITHUB_REPOSITORY}/git/refs/tags/${tag}" fi echo "Publishing development release..." From a0484084edcb45ea22d49df2a04fc74cc66ab231 Mon Sep 17 00:00:00 2001 From: Michael Oliver Date: Wed, 14 Oct 2026 12:42:46 -0700 Subject: [PATCH 2/2] ci(dev-build): move the tag before replacing the release, and keep it on failure Recreating the tag doesn't avoid the 403: re-running the ab7579e1 job with the tag already on that commit failed the same way. GITHUB_TOKEN may not point a ref at a commit whose workflow files differ from main's, which happens when a workflow change (#131) is merged during the build. Move the tag first and only delete and recreate the release when that works. Otherwise upload the files to the existing release with --clobber and update its notes, so a dev-build release always exists. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Michael Oliver --- .github/workflows/dev-build.yml | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/.github/workflows/dev-build.yml b/.github/workflows/dev-build.yml index f4799ae9..7550cedb 100644 --- a/.github/workflows/dev-build.yml +++ b/.github/workflows/dev-build.yml @@ -514,18 +514,31 @@ jobs: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | tag="dev-build" - if gh release view "$tag" >/dev/null 2>&1; then - echo "Recreating $tag release so published_at reflects the latest build time..." - gh release delete "$tag" --yes --cleanup-tag=false || true - fi - # Point the rolling tag at this commit by deleting it and letting `gh release create --target` - # create it again (`--target` is ignored when the tag already exists, and GitHub orders releases by - # the tagged commit's date). Don't move it with a PATCH: GITHUB_TOKEN can't update a ref across - # commits that change .github/workflows, so every build after a workflow change failed with - # "Resource not accessible by integration" after the release was already deleted. + # Point the rolling tag at this commit before touching the release. `gh release create --target` + # only applies when it creates the tag, and GitHub orders releases by the tagged commit's date. + # GITHUB_TOKEN may not point a ref at a commit whose .github/workflows differ from main's, which + # happens when a workflow change is merged while this build runs (ab7579e1 after #131). The + # release used to be deleted first, so that left no dev-build release at all. if gh api "repos/${GITHUB_REPOSITORY}/git/refs/tags/${tag}" >/dev/null 2>&1; then - gh api -X DELETE "repos/${GITHUB_REPOSITORY}/git/refs/tags/${tag}" + tag_cmd=(gh api -X PATCH "repos/${GITHUB_REPOSITORY}/git/refs/tags/${tag}" -f sha="$GITHUB_SHA" -F force=true) + else + tag_cmd=(gh api -X POST "repos/${GITHUB_REPOSITORY}/git/refs" -f ref="refs/tags/${tag}" -f sha="$GITHUB_SHA") + fi + if ! "${tag_cmd[@]}" >/dev/null; then + echo "::warning::Could not move the $tag tag to $GITHUB_SHA (workflow files changed on main during this build?). Updating the existing release's files and notes instead." + if gh release view "$tag" >/dev/null 2>&1; then + gh release upload "$tag" --clobber _dist/* + gh release edit "$tag" --notes-file dev_notes.md + exit 0 + fi + echo "::error::No $tag release to update." + exit 1 + fi + + if gh release view "$tag" >/dev/null 2>&1; then + echo "Recreating $tag release so published_at reflects the latest build time..." + gh release delete "$tag" --yes --cleanup-tag=false fi echo "Publishing development release..."