Automatically Assign PR Author if No Assignee is Set #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Assign PR Author | |
on: | |
pull_request: | |
types: [opened, reopened] | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
auto-assign: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check If Assignee Exists | |
uses: actions/github-script@v6 | |
id: check-assignee | |
with: | |
script: | | |
const assignees = context.payload.pull_request.assignees; | |
return assignees.length > 0; | |
- name: Assign PR Author If No Assignee | |
if: steps.check-assignee.outputs.result == 'false' | |
uses: actions-ecosystem/action-add-assignees@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
assignees: ${{ github.event.pull_request.user.login }} |