Pull requests
Task: create a GitHub action which automatically assigns a new pull request (PR) to its author and creates a list of potential reviewers from a permitted list.
Note: the examples link to the People and Code repository for this website and are not public.
Auto assign
This action uses Auto Assign Action
An action which adds reviewers to the pull request when the pull request is opened.
To create a list of accepted reviewers and auto-assign PRs to their author:
- Create a repository secret called
ASSIGN_REVIEWERS
- Go to
~/actions
- Click on "New workflow"
- Click on "set up a workflow for yourself"
- Create two yml files. See Auto Assign Action for yml specifics.
- Create
actions.yml
under~/.github/workflow
-
auto_assign.yml
under~/.github
- Create
- In order that the workflow has the correct permissions, add this line to the end of the
actions.yml
file:repo-token: ${{ secrets.ASSIGN_REVIEWERS }}
Therepo-token
must match the repository secret you created.
Outcome: When a PR is made, the author is assigned and a list of reviewers is generated. In our case (People and Code), the reviewer is automatically assigned because there is only one reviewer on the list who is not the author.
Review auto assign
To review or edit this action:
- Go to your repo
~/website
e.g. website repo - Select the actions tab
~/website/actions
e.g. actions tab - Click on workflow action in the "All workflows" panel
~/actions/workflows/actions.yml
e.g. Auto Assign - Click on the
actions.yml
link below the Auto Assign titlee.g. actions.yml
When you make a PR, the assignee will now be set automatically, and list of reviewers displayed. For details see Auto Assign Action.