Skip to content

Restore pull-requests: read permission in reset-drift-detection job#18

Merged
gsavage merged 1 commit into
mainfrom
restore-pull-requests-read-permission
May 21, 2026
Merged

Restore pull-requests: read permission in reset-drift-detection job#18
gsavage merged 1 commit into
mainfrom
restore-pull-requests-read-permission

Conversation

@gsavage

@gsavage gsavage commented May 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Reverts the removal in Remove unused pull-requests: read permission from apply.yml #16 / a040666.
  • The previous commit assumed that passing the token explicitly via --github-token "$GH_TOKEN" made the job's permissions: block irrelevant. That was wrong: the kosli_github_token secret is the caller's workflow GITHUB_TOKEN, and its capabilities are governed by the called job's permissions: block. Caller permissions: only act as an upper bound on reusable workflows — they do not propagate into them.
  • Without pull-requests: read, the kosli attest pr github step fails with Resource not accessible by integration (the canonical signature of a GitHub-App-backed token lacking a permission).

Test plan

  • Trigger an apply run from a caller repo that passes kosli_github_token and confirm kosli attest pr github no longer fails with "Resource not accessible by integration".

🤖 Generated with Claude Code

The previous commit (a040666) removed this permission on the assumption
that because `kosli attest pr github` is passed the token explicitly via
`--github-token "$GH_TOKEN"`, the job's permissions block was irrelevant.

That reasoning was wrong. The kosli_github_token secret is the caller's
workflow GITHUB_TOKEN. Its capabilities are governed by the called job's
permissions block, not the caller's — caller permissions only act as an
upper bound on reusable workflows and do not propagate into them.

Without pull-requests: read, the attestation step fails with:
  Resource not accessible by integration

Restore the permission so the step can read PR metadata.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@gsavage gsavage enabled auto-merge May 21, 2026 12:33
@gsavage gsavage disabled auto-merge May 21, 2026 12:41
@gsavage gsavage merged commit 6242151 into main May 21, 2026
1 check passed
@gsavage gsavage deleted the restore-pull-requests-read-permission branch May 21, 2026 12:41
gsavage added a commit that referenced this pull request May 26, 2026
## Summary

- Add `kosli_github_token` to the Secrets table in the README —
previously it was only documented in the workflow file itself.
- Update the example caller workflow to show passing the token and
granting the `pull-requests: read` permission, so anyone copy-pasting it
doesn't later hit `Resource not accessible by integration` when wiring
up the PR attestation step.
- Add a short note explaining that both the caller job and the called
job must grant `pull-requests: read`, since GitHub computes the token's
permissions in a reusable workflow as the intersection of the two.

Companion to #18 (which restores the permission on the called side).

## Test plan

- [ ] Render the README on GitHub and confirm the table and example look
right.
- [ ] Copy the example caller workflow into a fresh repo and confirm
`kosli attest pr github` succeeds.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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