Skip to content

fix: re-mint GitHub App token before goreleaser to avoid mid-run expiry - #281

Merged
Andriy Knysh (aknysh) merged 1 commit into
mainfrom
osterman/fix-goreleaser-app-token-expiry
Sep 4, 2026
Merged

fix: re-mint GitHub App token before goreleaser to avoid mid-run expiry#281
Andriy Knysh (aknysh) merged 1 commit into
mainfrom
osterman/fix-goreleaser-app-token-expiry

Conversation

@osterman

Copy link
Copy Markdown
Member

what

  • In shared-go-auto-release.yml's goreleaser job, mint a second, fresh
    GitHub App installation token immediately before the "Run GoReleaser" step
    (after all the setup/GPG-import/disk-cleanup steps), instead of reusing the
    single token minted at the very start of the job.
  • Use that fresh token for both the GoReleaser invocation itself and the
    immediately-following "Attest build provenance" step.

why

  • GitHub App installation tokens are hard-capped at 1 hour and cannot be
    extended or refreshed — that's a GitHub API limit, not something
    configurable in this workflow.
  • The job mints its token once at the very start, then hands it straight to a
    goreleaser release --timeout 180m invocation. GoReleaser's own reported
    build+sign+SBOM+publish runtime for atmos has been climbing on recent
    runs — 44m14s -> 53m14s -> 1h5m52s — and is now routinely exceeding that
    1-hour token ceiling.
  • When the token expires mid-run, GoReleaser's final publish-phase API call
    (listing/deleting existing draft releases before creating the new one)
    fails with a 401 Bad credentials, e.g.:
    ⨯ release failed after 1h5m52s error=scm releases: failed to publish
    artifacts: could not delete existing drafts: could not list existing
    drafts: GET https://api.github.com/repos/cloudposse/atmos/releases?per_page=50:
    401 Bad credentials []
    
    This looks like a credentials/permissions problem but is really just an
    expired token — confirmed by cross-referencing actions/create-github-app-token's
    documented 1-hour installation-token TTL against goreleaser's own
    self-reported elapsed time in the failing runs.
  • Re-minting right before the long-running step maximizes the runway the
    token has before goreleaser needs it, without touching goreleaser's own
    build/sign/SBOM/publish logic at all.

references

GitHub App installation tokens are hard-capped at 1 hour and cannot be
extended. The goreleaser job minted its token once at job start, then
handed it straight to a `goreleaser release --timeout 180m` invocation
whose own runtime (build + sign + SBOM + publish across every platform
target) has been climbing past 1 hour on recent atmos runs (44m -> 53m
-> 1h5m52s), so the token is already expired by the time goreleaser
reaches its final publish-phase API calls. That surfaces as an
unrelated-looking `401 Bad credentials` when goreleaser tries to
list/delete existing draft releases, not an error about the release
content itself.

Mint a second, fresh App token immediately before the "Run GoReleaser"
step (after all the setup/GPG/disk-cleanup steps that otherwise eat
into the original token's lifetime before goreleaser even starts), and
use it for both the GoReleaser invocation and the immediately-following
build-provenance attestation step.
@mergify

mergify Bot commented Sep 4, 2026

Copy link
Copy Markdown

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@mergify mergify Bot added the needs-cloudposse Needs Cloud Posse assistance label Sep 4, 2026
@mergify mergify Bot removed the triage Needs triage label Sep 4, 2026
@aknysh
Andriy Knysh (aknysh) merged commit 4e05ff6 into main Sep 4, 2026
4 checks passed
@aknysh
Andriy Knysh (aknysh) deleted the osterman/fix-goreleaser-app-token-expiry branch September 4, 2026 22:51
@mergify mergify Bot removed the needs-cloudposse Needs Cloud Posse assistance label Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants