A lightweight GitHub Action that automatically assigns pull requests to a designated maintainer.
- Create a
MAINTAINER.txtfile in your repository root containing a single GitHub username - Configure the action to run on PR label events and/or pushes
- When triggered, PRs are automatically assigned to the maintainer
| Event | Behavior |
|---|---|
pull_request with labeled action |
Assigns that PR to the maintainer |
push |
Removes previous maintainer and assigns new maintainer on all open labeled PRs |
Tip
On push events, utilize the paths: filter in your calling workflow to only run when MAINTAINER.txt changes. See the example workflow below.
Add a file named MAINTAINER.txt to your repository root with the maintainer's GitHub username:
octocat
Create .github/workflows/assign-maintainer.yml:
name: Assign PRs to Maintainer
on:
pull_request:
types: [labeled]
push:
branches: [master]
paths: ['MAINTAINER.txt'] # Only trigger when maintainer changes
permissions: # Required for the action to modify PRs
contents: read
pull-requests: write
jobs:
assign:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2 # Required for push event to detect previous maintainer
- uses: ExodusMovement/gh-dynamic-assignee@v2By default, the action triggers on the "Ready to Merge" label. To use a different label:
- uses: ExodusMovement/gh-dynamic-assignee@v2
with:
label_name: 'needs-review'| Input | Required | Default | Description |
|---|---|---|---|
label_name |
No | Ready to Merge |
Label that triggers assignment |
Your workflow must grant these permissions for the action to work:
permissions:
contents: read
pull-requests: write