Create a GitHub action

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:

  1. Create a repository secret called ASSIGN_REVIEWERS
  2. Go to ~/actions
  3. Click on "New workflow"
  4. Click on "set up a workflow for yourself"
  5. Create two yml files. See Auto Assign Action for yml specifics.
    1. Create actions.yml under ~/.github/workflow
    2. auto_assign.yml under ~/.github
  6. 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 }}
    The repo-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:

  1. Go to your repo ~/website
  2. Select the actions tab ~/website/actions
  3. Click on workflow action in the "All workflows" panel ~/actions/workflows/actions.yml
  4. Click on the actions.yml link below the Auto Assign title

When you make a PR, the assignee will now be set automatically, and list of reviewers displayed. For details see Auto Assign Action.