Skip to content

fix(workflows): fix GitHub App token permissions for maintainer detection#19139

Merged
bdmorgan merged 2 commits intomainfrom
fix/workflow-maintainer-token-permissions
Feb 15, 2026
Merged

fix(workflows): fix GitHub App token permissions for maintainer detection#19139
bdmorgan merged 2 commits intomainfrom
fix/workflow-maintainer-token-permissions

Conversation

@bdmorgan
Copy link
Collaborator

Summary

  • gemini-scheduled-stale-pr-closer.yml: The workflow was generating a repository-scoped GitHub App token (via owner + repositories parameters on create-github-app-token@v1), which blocked all org-level API access. This caused teams.listMembersInOrg to fail with 404 "Not Found" for every team, and prevented the API from resolving private org membership in author_association. As a result, maintainers like @mbleigh (a member of gemini-cli-maintainers with private org membership) were not recognized, and their PRs were automatically closed for lacking a linked issue. Fixed by upgrading to @v2 and removing owner/repositories scoping.
  • pr-contribution-guidelines-notifier.yml: Added team membership check as primary maintainer detection method. The webhook author_association does not reflect MEMBER for users with private org membership, so team-based detection provides a reliable fallback. Also upgraded to @v2.
  • gemini-scheduled-stale-issue-closer.yml: Upgraded from @v1 to @v2 for consistency.

Verification

A workflow_dispatch dry run of the stale PR closer was executed from this branch (run 22036540694). Results:

  • Token generation succeeded (previously failed with repository-scoped token)
  • author_association correctly identifies org members (zero incorrect closures)
  • Team fetch still returns 404 — the GitHub App needs Organization > Members: Read permission added separately

Test plan

  • Dry run of stale PR closer from branch (workflow_dispatch with dry_run=true) — passed
  • Verify no regressions on next pull_request: opened event after merge
  • Add members:read to GitHub App org permissions to enable team-based detection

…tion

The gemini-scheduled-stale-pr-closer workflow was generating a
repository-scoped GitHub App token (via `owner` + `repositories`
parameters), which blocked all org-level API access. This caused
`teams.listMembersInOrg` to fail with 404 "Not Found" for every team,
and prevented the API from resolving private org membership in
`author_association`. As a result, maintainers like mbleigh (a member of
gemini-cli-maintainers with private org membership) were not recognized,
and their PRs were automatically closed for lacking a linked issue.

Changes:
- gemini-scheduled-stale-pr-closer.yml: Upgrade to create-github-app-token@v2,
  remove `owner`/`repositories` scoping that blocked org-level access
- pr-contribution-guidelines-notifier.yml: Upgrade to create-github-app-token@v2,
  add team membership check as primary maintainer detection (webhook
  author_association does not reflect MEMBER for users with private org
  membership)
- gemini-scheduled-stale-issue-closer.yml: Upgrade to create-github-app-token@v2
  for consistency
@bdmorgan bdmorgan requested a review from a team as a code owner February 15, 2026 13:38
@gemini-code-assist
Copy link
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@github-actions
Copy link

Size Change: -2 B (0%)

Total Size: 24.4 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 24.4 MB -2 B (0%)
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B

compressed-size-action

@gemini-cli gemini-cli bot added the status/need-issue Pull requests that need to have an associated issue. label Feb 15, 2026
@bdmorgan bdmorgan merged commit 7f7424d into main Feb 15, 2026
26 of 27 checks passed
@bdmorgan bdmorgan deleted the fix/workflow-maintainer-token-permissions branch February 15, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant