Skip to content

Conversation

AClerbois
Copy link

This pull request introduces support for specifying team reviewers separately from individual reviewers in the configuration, improving flexibility and clarity for assigning reviewers to pull requests. The changes update configuration documentation, TypeScript types, implementation logic, and add comprehensive tests to ensure correct behavior for both individual and team reviewers.

Configuration and Documentation Updates:

  • Added a new team_reviewers section to the configuration files (README.md, auto_assign_example.yml) to allow specifying team reviewers distinctly from individual reviewers. Documentation clarifies that numberOfReviewers only affects individual reviewers, not teams. [1] [2]

TypeScript and Implementation Changes:

  • Updated the Config interface in src/handler.ts to include a teamReviewers array, reflecting the new configuration option.
  • Refactored the reviewer selection logic in src/util.ts (chooseReviewers) to filter out the PR creator from individual reviewers, select the appropriate number of individual reviewers, and always include all specified team reviewers. [1] [2]

Testing Enhancements:

  • Added new and updated existing tests in test/handler.test.ts and test/util.test.ts to verify correct handling of separate individual and team reviewers, including edge cases such as empty team reviewer lists and respecting the numberOfReviewers limit for individual reviewers. [1] [2] [3] [4]

Test Data Consistency:

  • Standardized reviewer group test data formatting in test/util.test.ts for clarity and consistency. [1] [2] [3] [4] [5] [6]

@Copilot Copilot AI review requested due to automatic review settings August 13, 2025 13:08
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces support for configuring team reviewers separately from individual reviewers, improving flexibility in pull request reviewer assignment. The change allows teams to be specified in a dedicated team_reviewers configuration field while maintaining existing functionality for individual reviewers.

  • Adds team_reviewers configuration option to specify team reviewers separately from individual reviewers
  • Updates reviewer selection logic to handle individual and team reviewers distinctly
  • Adds comprehensive test coverage for the new functionality

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/handler.ts Adds teamReviewers field to Config interface
src/util.ts Refactors chooseReviewers to handle separate team reviewers and individual reviewers
test/handler.test.ts Adds tests for team reviewer functionality and backward compatibility
test/util.test.ts Adds tests for chooseReviewers function and standardizes test data formatting
README.md Documents the new team_reviewers configuration option
auto_assign_example.yml Provides example configuration with separate team reviewers

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

reviewers: chosenReviewers.users,
team_reviewers: chosenReviewers.teams,
reviewers: chosenIndividualReviewers,
team_reviewers: team_reviewers || [],
Copy link
Preview

Copilot AI Aug 13, 2025

Choose a reason for hiding this comment

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

The fallback to empty array is unnecessary and potentially misleading. The destructuring assignment teamReviewers: team_reviewers on line 70 already handles undefined values by assigning undefined to team_reviewers. If teamReviewers is undefined in the config, this will result in team_reviewers: undefined || [] which works, but it would be clearer to handle the undefined case in the destructuring with a default value: teamReviewers: team_reviewers = [].

Suggested change
team_reviewers: team_reviewers || [],
team_reviewers: team_reviewers,

Copilot uses AI. Check for mistakes.

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.

1 participant