DEV Community

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

Posted on • Edited 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 }}"


Enter fullscreen mode Exit fullscreen mode

Source code:

GitHub logo toshimaru / auto-author-assign

GitHub Actions: Automatically assign pull request authors.

Build

auto-author-assign

GitHub Actions: Automatically assign pull request authors.

OG image

Why this action?

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

This action automatically assigns the pull request author as an assignee.

Usage

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

on:
  pull_request_target:
    types: [ opened, reopened ]

permissions:
  pull-requests: write

jobs:
  assign-author:
    runs-on: ubuntu-latest
    steps:
      - uses: toshimaru/auto-author-assign@v2.1.1
Enter fullscreen mode Exit fullscreen mode

Use your own token

You can specify your own token.

jobs:
  assign-author:
    runs-on: ubuntu-latest
    steps:
      - uses: toshimaru/auto-author-assign
        with:
          repo-token: ${{ secrets.YOUR_TOKEN }}
Enter fullscreen mode Exit fullscreen mode

If not specified, GITHUB_TOKEN will be used by default.

Enable auto-author-assign for issues

An issue's author can be automatically assigned as an issue assignee.

  • Add issues to the trigger
  • Add issues: write to the permissions
on
  issues:
    types: [ opened, reopened ]
Enter fullscreen mode Exit fullscreen mode

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.