forked from tianocore/edk2
-
Notifications
You must be signed in to change notification settings - Fork 3
47 lines (39 loc) · 1.49 KB
/
request-reviews.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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 edk2-pytool-library edk2-pytool-extensions 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)}")