Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically Add Reviewers to Pull Requests #5948

Merged
merged 3 commits into from
Jul 25, 2024

Conversation

makubacki
Copy link
Member

@makubacki makubacki commented Jul 22, 2024

Description

A series of changes to automate reviewers being added to pull requests in edk2.

Long term, it is preferred to exclusively depend upon GitHub Code Owners. This
PR is meant to provide an immediate solution to adding reviewers to PRs while
opens around CODEOWNERS are closed.


This wiki page has some details about the workflow Automatic Pull Request Reviewer Details.


BaseTools/GetMaintainer.py: Add GitHub username argument

Adds a new -g parameter so that output will also include the GitHub
username.

This change uses a simple regular expression as opposed to directly
returning the original line from the file to make the extraction of
GitHub usernames more robust to other changes on the line in the
maintainers text file.


.github: Add GitHub python script

Adds a script that provides GitHub API helpers for automation scripts
in the repository.


.github/workflows/request-reviews.yml: Add workflow

Adds a new GitHub workflow to automatically add reviewers to pull
requests when they are opened, reopened, synchronized, and if a draft
pull request is marked as ready for review. The workflow will not
run on draft pull requests.

The workflow is meant to be simple to understand and modify, relying
on existing logic in GetMaintainer.py to determine the relevant
reviewers and using simple Python GitHub REST API wrappers with the
default GitHub token for authentication.

Future changes may optimize the workflow.


  • Breaking change?
  • Impacts security?
  • Includes tests?

How This Was Tested

  • GitHub workflow on my edk2 GitHub fork
  • Local Python verification of GitHub REST API calls

Integration Instructions

  • N/A - Specific to edk2 GitHub repo automation

You can see this workflow running in the tianocore/edk2 repo (for this PR) here.

BaseTools/Scripts/GitHub.py Outdated Show resolved Hide resolved
BaseTools/Scripts/GitHub.py Outdated Show resolved Hide resolved
BaseTools/Scripts/GitHub.py Outdated Show resolved Hide resolved
BaseTools/Scripts/GitHub.py Outdated Show resolved Hide resolved
@spbrogan
Copy link
Member

The commit message for the workflow needs tweaking. I added two changes below highlighting using "**".

Adds a new GitHub workflow to automatically add reviewers to pull
requests when they are opened, reopened, synchronized, and if a draft
pull request is marked as ready for review. The workflow will not
run on draft pull requests.

The workflow is meant to be simple to understand and modify**,** relying
on existing logic in GetMaintainer.py to determine the relevant
reviewers and simply call the Python GitHub REST API wrappers using the
default GitHub token for authentication.

Future changes may optimize the workflow.

Adds a new `-g` parameter so that output will also include the GitHub
username.

This change uses a simple regular expression as opposed to directly
returning the original line from the file to make the extraction of
GitHub usernames more robust to other changes on the line in the
maintainers text file.

Signed-off-by: Michael Kubacki <[email protected]>
@makubacki
Copy link
Member Author

Going to make another small change before this is ready.

Adds a script that provides GitHub API helpers for workflows and
other GitHub automation in the repository.

Signed-off-by: Michael Kubacki <[email protected]>
@makubacki
Copy link
Member Author

Going to make another small change before this is ready.

Done

@makubacki makubacki added push Auto push patch series in PR if all checks pass and removed push Auto push patch series in PR if all checks pass labels Jul 25, 2024
@makubacki makubacki force-pushed the auto_pr_reviewers_edk2 branch 2 times, most recently from 1cd7600 to 69c0bfb Compare July 25, 2024 00:38
Adds a new GitHub workflow to automatically add reviewers to pull
requests when they are opened, reopened, synchronized, and if a draft
pull request is marked as ready for review. The workflow will not
run on draft pull requests.

The workflow is meant to be simple to understand and modify, relying
on existing logic in GetMaintainer.py to determine the relevant
reviewers and using simple Python GitHub REST API wrappers with the
default GitHub token for authentication.

Future changes may optimize the workflow.

Signed-off-by: Michael Kubacki <[email protected]>
@makubacki makubacki added the push Auto push patch series in PR if all checks pass label Jul 25, 2024
@mergify mergify bot merged commit 6271b61 into tianocore:master Jul 25, 2024
128 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
push Auto push patch series in PR if all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants