.github/request-reviews.yml: Add non-collab admin notification

If a non-collaborator is part of the reviewer list, an admin needs
to be notified so they can be removed.

This change finds the list of admins for the repo and notifies them
in the comment left on the PR describing the list of non-collaborator
users. The message itself is cleaned up to show only the
non-collaborator users for ease of identification.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
This commit is contained in:
Michael Kubacki 2024-07-31 18:54:02 -04:00 committed by mergify[bot]
parent e86647decd
commit 09ad1a0072

View File

@ -221,16 +221,29 @@ def add_reviewers_to_pr(
f"::error title=User is not a Collaborator!::{', '.join(non_collaborators)}" f"::error title=User is not a Collaborator!::{', '.join(non_collaborators)}"
) )
repo_admins = [
a.login for a in repo_gh.get_collaborators(permission="admin")
]
leave_pr_comment( leave_pr_comment(
token, token,
owner, owner,
repo, repo,
pr_number, pr_number,
f"&#9888; **WARNING: Cannot add reviewers**: A user specified as a " f"&#9888; **WARNING: Cannot add some reviewers**: A user "
f"reviewer for this PR is not a collaborator " f"specified as a reviewer for this PR is not a collaborator "
f"of the edk2 repository. Please add them as a collaborator to the " f"of the repository. Please add them as a collaborator to "
f"repository and re-request the review.\n\n" f"the repository so they can be requested in the future.\n\n"
f"Users requested:\n{', '.join(user_names)}", f"Non-collaborators requested:\n"
f"{'\n'.join([f'- @{c}' for c in non_collaborators])}"
f"\n\nAttn Admins:\n"
f"{'\n'.join([f'- @{a}' for a in repo_admins])}\n---\n"
f"**Admin Instructions:**\n"
f"- Add the non-collaborators as collaborators to the "
f"appropriate team(s) listed in "
f"[teams](https://github.com/orgs/tianocore/teams)\n"
f"- If they are no longer needed as reviewers, remove them "
f"from [`Maintainers.txt`](https://github.com/tianocore/edk2/blob/HEAD/Maintainers.txt)",
) )
# Add any new reviewers to the PR if needed. # Add any new reviewers to the PR if needed.