.github/scripts: Make reviewer filtering case insensitive

The `add_reviewers_to_pr()` function in GitHub.py did not compare
all usernames without case sensitivity which could cause a reviewer
that has already reviewed a pull request to be re-requested.

The occurred under the following conditions:

- GetMaintainer.py returns usernames from Maintainers.txt
  (e.g. "user")
- GitHub API returns usernames in their actual case (e.g. "User")
- The exclusion filter used case-sensitive comparison so the match
  is not detected

Fixed by converting the exclusion set to lowercase and performing
case-insensitive comparison when filtering for new reviewers.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
This commit is contained in:
Michael Kubacki 2025-11-25 20:22:17 -05:00 committed by mergify[bot]
parent 4411321f70
commit 43e86ce5d5

View file

@ -232,8 +232,13 @@ def add_reviewers_to_pr(
repo_collaborators = [c.login.strip().lower() for c in repo_gh.get_collaborators() if c]
non_collaborators = [u for u in user_names if u.lower() not in repo_collaborators]
excluded_pr_reviewers = [pr_author] + current_pr_reviewers + non_collaborators
new_pr_reviewers = [u for u in user_names if u not in excluded_pr_reviewers]
excluded_pr_reviewers = {
e.lower()
for e in [pr_author] + current_pr_reviewers + non_collaborators
}
new_pr_reviewers = [
u for u in user_names if u.lower() not in excluded_pr_reviewers
]
# Notify the admins of the repository if non-collaborators are requested.
if non_collaborators: