fix(fix-dependabot-alerts): refresh app token before creating PR#2393
Merged
Conversation
GitHub App installation tokens expire after 1 hour, but the build and verify phase routinely runs longer than that. The original app token minted at job start was expired by the time the `Create pull request` step ran, causing `gh pr list` / `gh pr create` to fail with 401 Bad credentials. The `git push` itself succeeded because actions/checkout uses the workflow's own GITHUB_TOKEN (valid for the full job lifetime), so the branch was pushed but no PR was opened. Mint a fresh app token immediately before the create-PR step. Repro: workflow_dispatch run 26475336645 (job duration 1h 14m). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GitHub App installation tokens expire after 1 hour, but the
fix-dependabot-alertsbuild/verify phase routinely runs longer than that. The original app token minted at job start was expired by the time theCreate pull requeststep ran, causinggh pr list/gh pr createto fail with 401 Bad credentials. Thegit pushitself succeeded becauseactions/checkoutuses the workflow's ownGITHUB_TOKEN(valid for the full job lifetime), so the branch was pushed but no PR was opened.This change mints a fresh app token immediately before the create-PR step.
Repro: workflow_dispatch run 26475336645 — job duration 1h 14m; app token minted at 21:10:02,
Create pull requeststep ran at 22:24:49 (~14 min past token expiry).The remediation branch from that run (
automated/fix-dependabot-alerts-20260526-63) is being opened as a separate PR manually.