summaryrefslogtreecommitdiff
path: root/.github/scripts/GitHub.py
AgeCommit message (Collapse)AuthorFilesLines
2025-05-13.github: Compare collaborator GitHub ID's in single caseMichael Kubacki1-2/+2
Since case of a GitHub user name may by specified differently in the `Maintainers.txt` file versus what is actually returned by the GitHub API (actual case), convert both to lowercase for comparison. Other GitHub user name inputs are directly from APIs and maintain consistent casing. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-11-26.github: Handle deleted GitHub accountsMichael Kubacki1-5/+8
If a GitHub account has been deleted entirely, a `None` user will be returrned from the GitHub API. This change accounts for a `None` user when querying GitHub APIs for user information. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-10-01.github/GitHub.py: Update bot in redundant comment checkMichael Kubacki1-1/+1
The project moved from using the `github-actions[bot]` bot account to the `tianocore-assign-reviewers[bot]` account. A check is in place to prevent the "`WARNING: Cannot add some reviewers`" from appearing more than once if nothing has changed in the content it would post. This change updates the bot account to the current one so the check can work again. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-08-05.github/request-reviews.yml: Formatting (non-functional)Michael Kubacki1-4/+8
Updates code for PEP8 formatting by using the Black code formatter. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-08-05.github/request-reviews.yml: Improve doc and dbg messagesMichael Kubacki1-6/+20
Adds additional documentation and cleans up debug messages printed to GitHub workflow output (available in the GitHub Actions pane). Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-08-05.github/request-reviews.yml: Only post non-collab message onceMichael Kubacki1-24/+34
Enhances the flow that adds a comment on a PR if a non-collaborator is in the reviewer list by checking if a comment was previously left on the PR. If it was for the same set of non-collaborators, another comment is not created. If a new non-collaborator is discovered, the message will be left identifying that new user account. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-08-05.github/request-reviews.yml: Add non-collab admin notificationMichael Kubacki1-5/+18
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>
2024-08-05.github/request-reviews.yml: Update PR reviewer exclusionMichael Kubacki1-4/+18
Updates logic to: - Not request reviews from reviewers that have already left a review on the PR. Previously, the reviewers review (e.g. approval) would remain on the PR, but they would be notified on each change to the PR. This approach follows the expected notification process for requesting reviews which is one time. Maintainers and reviewers can set up their own notifications for more granular updates on PR activity separately. - Add the collaborator reviewers if a reviewer(s) is found to not be a collaborator. This is an improvement to today's behavior which is to not add any reviewers if a single reviewer is not a collaborator of the repo. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-08-05.github/request-reviews.yml: Removed unused functionalityMichael Kubacki1-27/+0
Removed the `download_gh_file()` function which is no longer needed with sparse checkout. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-08-05.github/request-reviews.yml: Switch to PyGithubMichael Kubacki1-73/+103
Uses PyGithub for GitHub interactions instead of the GitHub REST API directly. This simplifies the code, improves error handling and robustness, and lets the PyGithub project abstract GitHub REST API changes that may occur over time. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-08-05.github/request-reviews.yml: Switch to GitPythonMichael Kubacki1-15/+7
Uses `GitPython` instead of invoking the git executable directly. This has the benefit of improving code readability and less support code for binary interaction. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-07-27.github/request-reviews.yml: Switch to pull_request_targetMichael Kubacki1-17/+65
This change simply moves the trigger to `pull_request_target`. The rest of this message contains verbose details related to that. `pull_request_target` is used instead of `pull_request` since the default GitHub token cannot pick up write permissions with the `pull_request` type on PRs from public forks. Write permission is needed to add reviewrs. This was previously tested on an edk2 fork where PRs were not from other public forks into the fork being used for testing but directly on the fork itself. Because `pull_request_target` runs the pull request in the context of the base branch (not the PR branch) some logic needs slightly modified. The main change is that the GitHub context will no longer give the PR branch HEAD as the PR commit SHA (i.e. `github.event.pull_request.head.sha`). The SHA will be the base branch (`master`) SHA as that is what is checked out for the workflow run. SO, the actual PR SHA is now fetched separately. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2024-07-25.github: Add GitHub helper python scriptMichael Kubacki1-0/+187
Adds a script that provides GitHub API helpers for workflows and other GitHub automation in the repository. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>