feat: add FILTER_TEAMS env var for dynamic team-based PR filtering#14
Merged
feat: add FILTER_TEAMS env var for dynamic team-based PR filtering#14
Conversation
Add support for filtering PRs by GitHub team membership instead of hardcoding individual usernames in FILTER_AUTHORS. The new FILTER_TEAMS env var accepts comma-separated org/team-slug values (e.g., 'my-org/frontend-team,my-org/backend-team'). At runtime, team members are resolved via the GitHub API and merged with any FILTER_AUTHORS entries (union). Changes: - env.py: Add filter_teams field to EnvVars dataclass with parsing - auth.py: Add get_team_members() function using github3-py team API - pr_conflict_detector.py: Resolve teams after auth, merge with filter_authors, pass combined set to existing filter logic - README.md: Document FILTER_TEAMS in config table, add example, note read:org permission requirement - action.yml: No changes needed (env-based config) - .env-example: Add FILTER_TEAMS template - Tests: 7 new tests (3 env parsing, 4 auth, 3 integration) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
f625183 to
f8cca52
Compare
- Use set instead of sorted list for O(1) membership lookups - Truncate log output to show count instead of full author list - Add test for overlapping team members deduplication - Fix README YAML snippet to include env: context wrapper Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove effective_filter_authors alias, use combined_filter_authors directly - Move FILTER_TEAMS format validation to env.py with ValueError (fail-fast) - Add warning when FILTER_TEAMS resolves no members and no FILTER_AUTHORS set - Add tests for validation in env.py and empty resolution warning Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jmeridth
approved these changes
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
FILTER_TEAMSenvironment variable that accepts comma-separated GitHub team slugs inorg/team-slugformat. At runtime, team members are resolved via the GitHub API and merged (union) with anyFILTER_AUTHORSentries.This addresses the maintenance burden of hardcoding individual usernames in
FILTER_AUTHORS— team membership changes propagate automatically.Changes
env.pyfilter_teamsfield toEnvVarsdataclass with parsingauth.pyget_team_members()function using github3-py team APIpr_conflict_detector.pyREADME.mdFILTER_TEAMSin config table + example workflow.env-exampleFILTER_TEAMStemplatetest_env.pytest_auth.pytest_pr_conflict_detector.pyUsage
Can be combined with
FILTER_AUTHORS:Notes
read:orgscope on the token (orMembers: Readfor GitHub Apps)