DEV Community

Cover image for Assign pull request author automatically with GitHub Actions
Toshimaru
Toshimaru

Posted on • Updated on

Assign pull request author automatically with GitHub Actions

My Workflow

Who should be the assignee of Pull Request ❓

In most cases, the Pull Request author should be assigned as an assignee.

My workflow, named Auto Author Assign, assigns PR author automatically when PR is opened.

toshimaru/auto-author-assign

Submission Category:

Maintainer Must-Haves

Auto Author Assign makes it easy for OSS maintainer to assign someone to PR and filter PR from the list.

Assigned Users

Yaml File or Link to Code

.github/workflows/auto-author-assign.yml:

name: 'Auto Author Assign'

on:
  pull_request_target:
    types: [opened, reopened]

jobs:
  assign-author:
    runs-on: ubuntu-latest
    steps:
      - uses: toshimaru/auto-author-assign@v1.1.0
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"

Source code:

GitHub logo toshimaru / auto-author-assign

GitHub Actions: Assign pull request author automatically.

Build

auto-author-assign

GitHub Actions: Assign pull request author automatically.

OG image

Why this action?

In most cases, pull request author should be assigned an assignee of the pull request.

This action automatically assigns PR author as an assignee.

Usage

# .github/workflows/auto-author-assign.yml
name: 'Auto Author Assign'

on:
  pull_request_target:
    types: [opened, reopened]

jobs:
  assign-author:
    runs-on: ubuntu-latest
    steps:
      - uses: toshimaru/auto-author-assign@v1.1.0
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"

Skip assigning author

auto-author-assign action skips assigning the author when:

  • Someone is already assigned as an assignee
  • The author is a bot

Additional Resources / Info

Top comments (3)

Collapse
 
noitidart profile image
Noitidart

Whats the benefit of assigning someone to a PR? Whenever I open a PR I never assign myself to it. Does github do some cool stuff like when some hits "Requests CHanges" it messages me?

Collapse
 
arthurseredaa profile image
Hey! I'm Arthur

When you work in big team on 1 project, you could have more that a few opened pull request and sometimes you need to find PR of specific person, so for this you can use filter by author and if you use assign field - you could see PR's of that person

Collapse
 
sbimochan profile image
Bimochan Shrestha

I don't too. The only benefit I found is, it provides a profile picture in pull requests page shown above in red box and I'm thinking to use this action.