forked from tianocore/edk2
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.github/workflows: Add PR reviewer automation
- Loading branch information
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Add Pull Request Reviewers | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
types: [opened, ready_for_review, reopened] | ||
|
||
env: | ||
GET_MAINTAINER_REL_PATH: "BaseTools/Scripts/GetMaintainer.py" | ||
|
||
jobs: | ||
auto-request-review: | ||
name: Add Pull Request Reviewers | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install requests library | ||
run: pip install requests | ||
|
||
- name: Add Reviewers to Pull Request | ||
shell: python | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN }} | ||
ORG_NAME: ${{ github.repository_owner }} | ||
PR_NUMBER: ${{ github.event.number}} | ||
REPO_NAME: ${{ github.repository }} | ||
WORKSPACE_PATH: ${{ github.workspace }} | ||
run: | | ||
import os | ||
import sys | ||
sys.path.append(os.environ['WORKSPACE_PATH']) | ||
from BaseTools.Scripts import GitHub | ||
reviewers = GitHub.get_reviewers_for_current_branch(WORKSPACE_PATH, GET_MAINTAINER_LOCAL_PATH) | ||
if not reviewers: | ||
print("::notice title=No Reviewers Found!::No reviewers found for this PR.") | ||
sys.exit(1) | ||
print(f"::notice title=Reviewer List::Reviewers found for PR {os.environ['GITHUB_OUTPUT']}:\n{', '.join(reviewers)}") |