From b2cdf85d682b518f1f513436a912c01e2ed047ec Mon Sep 17 00:00:00 2001 From: Manuel de Brito Fontes Date: Thu, 19 Nov 2026 11:52:03 -0300 Subject: [PATCH] release: tag through the API, not git push v20261119.01 built, signed and attested, and its tag push was refused: GitHub will not let GITHUB_TOKEN push a ref whose commits change .github/workflows/ without a workflows permission that token cannot hold. It is the first release with a workflow change since the one before it. The API creates the ref under contents: write. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 1 + Taskfile.yml | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4dd309d..de6681d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -165,6 +165,7 @@ jobs: - name: Tag the commit env: VERSION: ${{ steps.version.outputs.version }} + GH_TOKEN: ${{ github.token }} run: go tool task release:tag - name: Publish diff --git a/Taskfile.yml b/Taskfile.yml index ac5222a..b296ce4 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -514,12 +514,18 @@ tasks: attestgate files -require cdx -except '*.sha256,machine.env,*.cdx.json' _output/release release:tag: - desc: Tag this commit VERSION and push the tag. A version tagged already is refused, since git push does not move a tag. + desc: Tag this commit VERSION on GitHub. A version tagged already is refused, since creating a ref that exists fails. cmds: + # Through the API and not `git push`: GitHub refuses a pushed ref from GITHUB_TOKEN when the + # commits under it change .github/workflows/, a permission that token cannot hold ("refusing + # to allow a GitHub App to create or update workflow ... without `workflows` permission", + # v20261119.01, the first release with a workflow change since the one before it). Creating + # the ref is contents: write, which the release has. A lightweight tag, as the pushed one was. - | set -euo pipefail - git tag "$VERSION" - git push origin "$VERSION" + gh api "repos/${GITHUB_REPOSITORY}/git/refs" \ + -f ref="refs/tags/${VERSION}" -f sha="$(git rev-parse HEAD)" --jq '.ref' + git fetch --quiet origin "refs/tags/${VERSION}:refs/tags/${VERSION}" shell: desc: >-