This repository provides a GitHub action to automatically label a pull request based reviewers assigned. This is useful if multiple team are working on the same project.
You need to provide a yml file that contains the label and a list of the reviewers that assign that label:
'Team Light Triaged':
assigned:
teams:
- '@Company/team-light'
users:
- '@Luke'
'Team Dark Triaged':
assigned:
teams:
- '@Company/team-dark'
users:
- '@DarkVador'
- '@Palpatine'
'Team Light Triaged Approved':
approved:
teams:
- '@Company/team-light'
Create a workflow (eg: .github/workflows/reviewer-labeler.yml
see Creating a Workflow file) to utilize the labeler action.
This action only needs the GITHUB_TOKEN secret as it interacts with the GitHub API to modify labels. It's working for pull request and issues. The action can be used as such:
on:
pull_request:
issues:
name: reviewer-labeler
permissions:
contents: read
pull-requests: write
jobs:
reviewer-labeler:
runs-on: ubuntu-latest
steps:
- uses: Mojang/auto-reviewer-labeler-action@cd44e44ed3a1132038cedcf2f1d908c27b764f04 #v1.0.1
with:
repo-token: "${{ secrets.PAT_GITHUB_REPO_SCOPE }}"
configuration-path: /.github/reviewer_labels.yml