Repository navigation
fix(ci): use GITHUB_TOKEN to check out the docs job - #287
Merged
Merged
Conversation
The docs job checks out the pull request branch with a token taken from secrets.GH_PERSONAL_ACCESS_TOKEN, falling back to GITHUB_TOKEN only when that secret is empty. When the PAT is set but no longer valid, the fetch is rejected and the job fails with 'could not read Username'. Use GITHUB_TOKEN and grant the job contents: write so terraform-docs can still push. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.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.
Why
The
docsjob intest.yamlfails at checkout on pull requests, which also skips theterraformjob that needs it. Example: run 46891875567 ends withfatal: could not read Username for 'https://github.com': terminal prompts disabledwhile fetching the PR branch. The last green run on a Renovate branch was 42543983089 (2026-11-09); runs have failed since 2026-11-23.The checkout token is
secrets.GH_PERSONAL_ACCESS_TOKEN || secrets.GITHUB_TOKEN. The fallback applies only when the PAT secret is empty, so a PAT that is set but expired or revoked is used and rejected.What changed
In the
docsjob only: the checkout token issecrets.GITHUB_TOKEN, and the job getspermissions: contents: writeso terraform-docs can still push its commit.Notes
GITHUB_TOKENdo not start new workflow runs, so a docs commit added by this job will not re-trigger the checks by itself.release.yamlandgithub-ip-ranges.yamlalso useGH_PERSONAL_ACCESS_TOKENand are not changed here. If the PAT is expired they will fail too.GITHUB_TOKENread-only there and cannot push docs changes.🤖 Generated with Claude Code