Add labels to GitHub PRs based on the contents of CODEOWNERS
jobs:
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: PR Codeowner Autolabel
id: pr-codeowner-autolabel
uses: mdzhang/pr-codeowner-autolabel
with:
# default is CODEOWNERS
file-path: .github/CODEOWNERS
repo-token: ${{ secrets.GITHUB_TOKEN }}
labels-to-owners: |
{
"frontend": "@myteam/@frontend-guild"
}
Note that dependabot PRs will get labeled by default as well! If not desired add the following to the workflow:
if: ${{ github.actor != 'dependabot[bot]' }}
In order to add labels to pull requests, this action requires write permissions on the pull-request. Refer to the GitHub token permissions documentation for more details about access levels and event contexts.
See CONTRIBUTING.md for information on how to contribute.