Skip to content

fix(ci): use ORG_READ_TOKEN for org membership check in vouch gate#445

Merged
johntmyers merged 1 commit intomainfrom
fix/vouch-check-org-token
Mar 18, 2026
Merged

fix(ci): use ORG_READ_TOKEN for org membership check in vouch gate#445
johntmyers merged 1 commit intomainfrom
fix/vouch-check-org-token

Conversation

@johntmyers
Copy link
Collaborator

Summary

  • The GITHUB_TOKEN fundamentally cannot determine org membership — read:org is not a configurable scope for it. Both author_association (via REST API) and orgs.checkMembershipForUser return NONE/404 for org members when called with the repo-scoped token.
  • Uses an ORG_READ_TOKEN secret when available, falling back to GITHUB_TOKEN
  • Also added Kh4L to VOUCHED.td on the vouched branch as an interim workaround so fix(sandbox): rotate openshell.log daily, keep 3 files #431 can be reopened now

Related Issue

Follow-up to #442 and #444. Fixes the false positive closing of #430 / #431.

Changes

  • .github/workflows/vouch-check.yml:
    • Pass ORG_READ_TOKEN (with GITHUB_TOKEN fallback) via github-token to actions/github-script
    • Restore orgs.checkMembershipForUser and repos.checkCollaborator checks — they work correctly with a token that has read:org
    • Add status codes to error logs for easier debugging

Setup Required

Create a fine-grained PAT (or classic PAT) with Organization > Members > Read (read:org) permission, then add it as a repo secret named ORG_READ_TOKEN.

Until that secret exists, the workflow falls back to GITHUB_TOKEN and org members will need to be in VOUCHED.td to bypass the gate.

Testing

  • Confirmed via logs that GITHUB_TOKEN returns author_association=NONE for org member Kh4L (run 23254861242)
  • Confirmed via local gh api (with read:org token) that the same endpoint returns MEMBER
  • Kh4L added to VOUCHED.td for immediate unblocking

Checklist

  • Follows Conventional Commits format
  • No new dependencies introduced

The GITHUB_TOKEN cannot determine org membership — it lacks read:org
scope and this is not configurable via the permissions block. Both
author_association and orgs.checkMembershipForUser return NONE/404 for
org members (even public ones) when called with the repo-scoped token.

Use an ORG_READ_TOKEN secret (fine-grained PAT with read:org) when
available, falling back to GITHUB_TOKEN. Also restores the
checkCollaborator fallback since the PAT can resolve that too.

Setup required: create a fine-grained PAT with Organization > Members >
Read permission, then add it as a repo secret named ORG_READ_TOKEN.
@johntmyers johntmyers requested a review from a team as a code owner March 18, 2026 16:18
@pimlock
Copy link
Collaborator

pimlock commented Mar 18, 2026

Kh4L added to VOUCHED.td for immediate unblocking

I don't see VOUCHED.td change committed, should it be part of this PR?

@johntmyers johntmyers merged commit 82cb8d2 into main Mar 18, 2026
10 checks passed
@johntmyers johntmyers deleted the fix/vouch-check-org-token branch March 18, 2026 16:24
drew pushed a commit that referenced this pull request Mar 18, 2026
)

The GITHUB_TOKEN cannot determine org membership — it lacks read:org
scope and this is not configurable via the permissions block. Both
author_association and orgs.checkMembershipForUser return NONE/404 for
org members (even public ones) when called with the repo-scoped token.

Use an ORG_READ_TOKEN secret (fine-grained PAT with read:org) when
available, falling back to GITHUB_TOKEN. Also restores the
checkCollaborator fallback since the PAT can resolve that too.

Setup required: create a fine-grained PAT with Organization > Members >
Read permission, then add it as a repo secret named ORG_READ_TOKEN.

Co-authored-by: John Myers <johntmyers@users.noreply.github.com>
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.

2 participants