Skip to content

fix(ci): use GITHUB_TOKEN to check out the docs job - #287

Merged
mcaulifn merged 1 commit into
mainfrom
fix-docs-job-token
Dec 2, 2026
Merged

mcaulifn merged 1 commit into
mainfrom
fix-docs-job-token

Conversation

@mcaulifn

@mcaulifn mcaulifn commented Dec 2, 2026

Copy link
Copy Markdown
Member

Why

The docs job in test.yaml fails at checkout on pull requests, which also skips the terraform job that needs it. Example: run 46891875567 ends with fatal: could not read Username for 'https://github.com': terminal prompts disabled while 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 docs job only: the checkout token is secrets.GITHUB_TOKEN, and the job gets permissions: contents: write so terraform-docs can still push its commit.

Notes

  • Commits pushed with GITHUB_TOKEN do not start new workflow runs, so a docs commit added by this job will not re-trigger the checks by itself.
  • release.yaml and github-ip-ranges.yaml also use GH_PERSONAL_ACCESS_TOKEN and are not changed here. If the PAT is expired they will fail too.
  • Checks on pull requests from forks run without secrets, so the job uses GITHUB_TOKEN read-only there and cannot push docs changes.

🤖 Generated with Claude Code

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>
@mcaulifn
mcaulifn requested a review from a team as a code owner December 2, 2026 14:17
@mcaulifn
mcaulifn merged commit 1911c33 into main Dec 2, 2026
4 checks passed
@mcaulifn
mcaulifn deleted the fix-docs-job-token branch December 2, 2026 14:23
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.

1 participant