Skip to content

fix(teams): ignore teams that hold an All-repository organization role - #1113

Open
rudycelekli wants to merge 1 commit into
github-community-projects:main-enterprisefrom
rudycelekli:fix/org-wide-role-teams-1112
Open

rudycelekli wants to merge 1 commit into
github-community-projects:main-enterprisefrom
rudycelekli:fix/org-wide-role-teams-1112

Conversation

@rudycelekli

Copy link
Copy Markdown

Fixes #1112

Root cause

A team with an organization role such as "All-repository read" is returned by repos.listTeams for every repository. It is not declared in the safe-settings config, so the Teams plugin treats it as an extra team and reports (and, when applying, performs) a removal on each repo. The plugin already skips teams holding the security_manager role; the All-repository roles were not covered.

Change

lib/plugins/teams.js: the org-role discovery now covers the security_manager role and the All-repository read/triage/write/maintain/admin roles, collects the teams of every matching role, and leaves those teams untouched (same handling as security manager teams, including the add/update/remove no-ops and the discovery-failure deletion protection).

Verification

  • Added a unit test (fails before the change, passes after) where a team holding "All-repository read" is not deleted while an unrelated undeclared team still is.
  • npx jest test/unit/lib/plugins/teams.test.js: 46 passed. npm run test:unit: 1005 passed, 12 skipped.
  • standard and eslint clean on the two changed files.

Not run

  • Not tested against a real GitHub organization; the API responses are mocked (that listTeams returns role-holding teams is taken from the issue report).
  • Integration tests and the repo-wide eslint . were not run (the latter already reports errors in unrelated files).
  • The triage/write/maintain/admin variants and the role-name matching for predefined roles rely on the documented role names and are covered only by the read case in tests.

Note: draft PR #1043 also touches the security manager handling in this plugin; this change may need a rebase depending on which lands first.

🤖 Generated with Claude Code

Teams granted an organization-wide role such as "All-repository read"
show up in every repo's team list. Because they are not declared in the
safe-settings config, the Teams plugin reported (and in apply mode
performed) a removal for each of them on every repository.

Treat the All-repository read/triage/write/maintain/admin roles like the
security manager role: discover their teams and leave them untouched.

Fixes github-community-projects#1112

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 19, 2026 10:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

This branch has not been deployed

No deployments
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.

Team with organization role "All-repository read" results in a diff in each repo

2 participants