Skip to content

Commit

Permalink
.github/workflows/request-reviews.yml: Latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
makubacki committed Jul 22, 2024
1 parent d89296f commit e734cec
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/request-reviews.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,49 @@ jobs:
auto-request-review:
name: Add Pull Request Reviewers
runs-on: ubuntu-latest

permissions:
contents: read
issues: write
pull-requests: write
statuses: read

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Install requests library
run: pip install requests
- name: Install PIP Modules
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 }}
REPO_NAME: ${{ github.event.pull_request.base.repo.name }}
WORKSPACE_PATH: ${{ github.workspace }}
run: |
import os
import sys
sys.path.append(os.environ['WORKSPACE_PATH'])
from BaseTools.Scripts import GitHub
WORKSPACE_PATH = os.environ['WORKSPACE_PATH']
GET_MAINTAINER_LOCAL_PATH = os.path.join(os.environ['WORKSPACE_PATH'], os.environ['GET_MAINTAINER_REL_PATH'])
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)}")
print(f"::notice title=Reviewer List::Reviewers found for PR {os.environ['PR_NUMBER']}:\n{', '.join(reviewers)}")
GitHub.add_reviewers_to_pr(os.environ['GH_TOKEN'], os.environ['ORG_NAME'], os.environ['REPO_NAME'], os.environ['PR_NUMBER'], reviewers)

0 comments on commit e734cec

Please sign in to comment.