Skip to content

fix(ci): check author_association before API calls in vouch gate#442

Merged
johntmyers merged 1 commit intomainfrom
fix/vouch-check-author-association
Mar 18, 2026
Merged

fix(ci): check author_association before API calls in vouch gate#442
johntmyers merged 1 commit intomainfrom
fix/vouch-check-author-association

Conversation

@johntmyers
Copy link
Collaborator

Summary

  • Fixes the vouch-check workflow incorrectly closing PRs from NVIDIA org members (e.g. fix(sandbox): rotate openshell.log daily, keep 3 files #430)
  • Adds an author_association check from the webhook payload as the primary bypass, before the API calls that fail due to insufficient GITHUB_TOKEN permissions

Related Issue

Fixes the false positive that closed #430

Changes

  • .github/workflows/vouch-check.yml: Read author_association from context.payload.pull_request and skip the vouch gate for MEMBER, OWNER, and COLLABORATOR associations. The existing orgs.checkMembershipForUser and repos.checkCollaborator API calls are kept as fallbacks.

Root cause

The GITHUB_TOKEN only has contents: read and pull-requests: write permissions. The orgs.checkMembershipForUser API requires read:org scope to see non-public org members — a scope GITHUB_TOKEN doesn't support. When a member has private org membership, the API returns 404, the catch block swallows it (since it specifically ignores 404s), and the workflow falls through to closing the PR.

author_association is set server-side by GitHub on every webhook event and correctly reports MEMBER for org members regardless of public/private visibility, with no extra token permissions needed.

Testing

Checklist

  • Follows Conventional Commits format
  • No new dependencies introduced

The vouch-check workflow was closing PRs from NVIDIA org members because
the GITHUB_TOKEN lacks read:org scope, causing orgs.checkMembershipForUser
to return 404 for non-public members. The catch block silently swallowed
these as expected 'not found' responses.

Add an author_association check from the webhook payload as the primary
bypass. GitHub sets this field server-side (MEMBER, OWNER, COLLABORATOR)
regardless of membership visibility, with no extra token permissions
needed. The existing API calls are kept as fallbacks.

Fixes the false positive that closed #430.
@johntmyers johntmyers merged commit 240d0ee into main Mar 18, 2026
10 checks passed
@johntmyers johntmyers deleted the fix/vouch-check-author-association branch March 18, 2026 15:53
johntmyers added a commit that referenced this pull request Mar 18, 2026
…load

The webhook payload field context.payload.pull_request.author_association
is unreliable under pull_request_target events — it was absent or not
populated, causing the previous fix (#442) to still fail.

Switch to fetching author_association via pulls.get REST API, which only
needs pull-requests permission (already granted) and reliably returns
MEMBER for org members regardless of membership visibility.

Also removes the redundant orgs.checkMembershipForUser and
repos.checkCollaborator fallbacks, which suffered from the same
GITHUB_TOKEN permission limitation that started this bug.
johntmyers added a commit that referenced this pull request Mar 18, 2026
…load (#444)

The webhook payload field context.payload.pull_request.author_association
is unreliable under pull_request_target events — it was absent or not
populated, causing the previous fix (#442) to still fail.

Switch to fetching author_association via pulls.get REST API, which only
needs pull-requests permission (already granted) and reliably returns
MEMBER for org members regardless of membership visibility.

Also removes the redundant orgs.checkMembershipForUser and
repos.checkCollaborator fallbacks, which suffered from the same
GITHUB_TOKEN permission limitation that started this bug.

Co-authored-by: John Myers <johntmyers@users.noreply.github.com>
drew pushed a commit that referenced this pull request Mar 18, 2026
The vouch-check workflow was closing PRs from NVIDIA org members because
the GITHUB_TOKEN lacks read:org scope, causing orgs.checkMembershipForUser
to return 404 for non-public members. The catch block silently swallowed
these as expected 'not found' responses.

Add an author_association check from the webhook payload as the primary
bypass. GitHub sets this field server-side (MEMBER, OWNER, COLLABORATOR)
regardless of membership visibility, with no extra token permissions
needed. The existing API calls are kept as fallbacks.

Fixes the false positive that closed #430.

Co-authored-by: John Myers <johntmyers@users.noreply.github.com>
drew pushed a commit that referenced this pull request Mar 18, 2026
…load (#444)

The webhook payload field context.payload.pull_request.author_association
is unreliable under pull_request_target events — it was absent or not
populated, causing the previous fix (#442) to still fail.

Switch to fetching author_association via pulls.get REST API, which only
needs pull-requests permission (already granted) and reliably returns
MEMBER for org members regardless of membership visibility.

Also removes the redundant orgs.checkMembershipForUser and
repos.checkCollaborator fallbacks, which suffered from the same
GITHUB_TOKEN permission limitation that started this bug.

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