Skip to content

Check that both tokens reach every managed repository - #30

Closed
benbirt wants to merge 1 commit into
mainfrom
token-access
Closed

benbirt wants to merge 1 commit into
mainfrom
token-access

Conversation

@benbirt

@benbirt benbirt commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to today's failed Dependabot auto-merge run: benbirt/posthog was added to the list (#27) before AUTOMATION_TOKEN included it, and the hourly run failed on it with GraphQL: Resource not accessible by personal access token (mergePullRequest). A rerun succeeded once the token's access had been updated.

token-access.yaml (new) fetches each managed repository with each token, and fails with one error per gap, for example:

AUTOMATION_TOKEN cannot reach benbirt/posthog: add it to the token's repository access.

  • When: on pull requests and pushes to main that change repos.jsonnet, daily at 06:11 UTC, and by hand. On a pull request that adds a repository, the check goes red until both tokens include it. It is not a required check, so it does not block the merge on its own.
  • Tokens: the list is compiled in a job without them; they go only to the job that calls the API. Dependabot's and forks' pull requests are skipped.
  • Limit: it checks that the repository is in each token's access (otherwise the API answers 404), not the token's permission level. The API reports the owner's role, not the token's, so there is no way to read that.

Testing

Locally, the same loop with both tokens reaches all 11 managed repositories, and gh api fails (exit 1) for a repository a token cannot reach. actionlint passes. This pull request touches the workflow, so its own run is the first test.

The comments and README sentences were written by Neon.

🤖 Generated with Claude Code

token-access.yaml fetches every managed repository with AUTOMATION_TOKEN
and with ADMIN_TOKEN, and fails naming any that a token cannot reach. It
runs on pull requests that change repos.jsonnet, so a new repository
cannot be added to the list before both tokens include it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@benbirt

benbirt commented Nov 29, 2026

Copy link
Copy Markdown
Owner Author

Closing: fine-grained tokens can read every public repository whatever their access, so this check would not have caught the gap, and a repository defined in the list does not exist yet on its pull request. The automation token now has access to all repositories instead.

@benbirt benbirt closed this Nov 29, 2026
@benbirt
benbirt deleted the token-access branch November 29, 2026 20: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