Skip to content

About

An action which adds reviewers to the pull request when the pull request is opened.

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

Auto Assign Action

An action which adds reviewers to the pull request when the pull request is opened.

▶️ Usage

Create a workflow (e.g. .github/workflows/action.yml For more detail, refer to Configuring a workflow) for running the auto-assign action.

name: 'Auto Assign'
on:
  pull_request:
    types: [opened, ready_for_review]

jobs:
  add-reviews:
    runs-on: ubuntu-latest
    steps:
      - uses: kentaro-m/auto-assign-action@v2.0.1
        with:
          configuration-path: '.github/some_name_for_configs.yml' # Only needed if you use something other than .github/auto_assign.yml

Change event that triggers a workflow to the pull_request_target if you want to enable the auto-assign action when opening pull requests from fork repositories or bots like Dependabot.

Using dangerous misuse of the pull_request_target event can be a security risk, so make sure you understand pros and cons before using it.

See below for details:

name: 'Auto Assign'
 on:
-  pull_request:
+  pull_request_target:
     types: [opened, ready_for_review]

 jobs:

Create a separate configuration file for the auto-assign action (e.g. .github/auto_assign.yml).

Single Reviewers List

Add reviewers/assignees to the pull request based on single reviewers list.

# Set to true to add reviewers to pull requests
addReviewers: true

# Set to true to add assignees to pull requests
addAssignees: false

# A list of reviewers to be added to pull requests (GitHub user name)
reviewers:
  - reviewerA
  - reviewerB
  - reviewerC

# A number of reviewers added to the pull request
# Set 0 to add all the reviewers (default: 0)
numberOfReviewers: 0
# A list of assignees, overrides reviewers if set
# assignees:
#   - assigneeA

# A number of assignees to add to the pull request
# Set to 0 to add all of the assignees.
# Uses numberOfReviewers if unset.
# numberOfAssignees: 2

# A list of keywords to be skipped the process that add reviewers if pull requests include it
# skipKeywords:
#   - wip

Multiple Reviewers List

Add reviewers/assignees to the pull request based on multiple reviewers list.

If you and peers work at the separate office or they work at the separate team by roles like frontend and backend, you might be good to use adding reviewers from each group.

# Set to true to add reviewers to pull requests
addReviewers: true

# Set to true to add assignees to pull requests
addAssignees: false

# A number of reviewers added to the pull request
# Set 0 to add all the reviewers (default: 0)
numberOfReviewers: 1

# A number of assignees to add to the pull request
# Set to 0 to add all of the assignees.
# Uses numberOfReviewers if unset.
# numberOfAssignees: 2

# Set to true to add reviewers from different groups to pull requests
useReviewGroups: true

# A list of reviewers, split into different groups, to be added to pull requests (GitHub user name)
reviewGroups:
  groupA:
    - reviewerA
    - reviewerB
    - reviewerC
  groupB:
    - reviewerD
    - reviewerE
    - reviewerF

# Set to true to add assignees from different groups to pull requests
useAssigneeGroups: false
# A list of assignees, split into different froups, to be added to pull requests (GitHub user name)
# assigneeGroups:
#   groupA:
#     - assigneeA
#     - assigneeB
#     - assigneeC
#   groupB:
#     - assigneeD
#     - assigneeE
#     - assigneeF

# A list of keywords to be skipped the process that add reviewers if pull requests include it
# skipKeywords:
#   - wip

Filter reviewer groups by changed paths

Use a release (or commit) whose bundled dist/index.js includes this feature. GitHub Actions executes that bundle, not the TypeScript source. A source-only commit with an older bundle can report candidates.filter is not a function for the object syntax below. When upgrading, update your workflow's pinned action version or SHA to the release-built commit.

A reviewer group can use paths and excludePaths glob patterns instead of the legacy reviewer list. Patterns are matched against paths relative to the repository root. The action selects reviewers from every group with at least one changed file that matches paths without matching excludePaths.

When paths is omitted, the group includes all paths by default. This allows a general group to exclude paths reserved for specialist groups without listing every other path in the repository:

addReviewers: true
numberOfReviewers: 1
useReviewGroups: true

reviewGroups:
  frontend:
    reviewers:
      - frontendReviewerA
      - frontendReviewerB
    paths:
      - 'apps/web/**'

  backend:
    reviewers:
      - backendReviewerA
      - backendReviewerB
    paths:
      - 'services/api/**'

  general:
    reviewers:
      - generalReviewerA
      - generalReviewerB
    excludePaths:
      - 'apps/web/**'
      - 'services/api/**'

In this example, a pull request that only changes apps/web/** selects from frontend, while changes elsewhere select from general. A pull request that changes both frontend and general files selects from both groups. excludePaths takes precedence over paths for each changed file.

The original list syntax remains supported and always matches:

reviewGroups:
  maintainers:
    - reviewerA
    - reviewerB

Assign Author as Assignee

Add the PR creator as the assignee of the pull request.

# Set addAssignees to 'author' to set the PR creator as the assignee.
addAssignees: author

Filter by label

The action will only run if the PR meets the specified filters

filterLabels:
  # Run
  include:
    - my_label
    - another_label
  # Not run
  exclude:
    - wip

Filter draft PRs

The action will only run for non-draft PRs. If you want to run for all PRs, you need to enable it to run on drafts.

runOnDraft: true

Development

This repository uses mise to install the configured Node.js version and run common development tasks.

GitHub REST API types

GitHub REST requests use openapi-fetch with types generated by openapi-typescript. The generated declarations in src/generated/github.d.ts are checked in, so normal builds, tests, packaging, and action runs do not download an API specification.

To regenerate them explicitly, run:

npm run generate:github-types

The command uses GitHub's official bundled OpenAPI 3.0 description pinned to commit 3cef12e8a02d612ad032473d4fb87266f2befeae and openapi-typescript 7.13.0. Update both the immutable URL in package.json and the checked-in declaration when intentionally moving the specification pin.

Network proxy support

openapi-fetch uses the native fetch implementation included with Node.js 24; the action does not bundle the npm undici package. Unlike @actions/github, native fetch does not automatically use HTTP_PROXY, HTTPS_PROXY, and NO_PROXY unless Node's environment proxy support is enabled when the action process starts. Self-hosted runners that require a proxy can set NODE_USE_ENV_PROXY=1 in the runner environment (or start Node with --use-env-proxy).

mise install
mise run setup
mise run check

Run mise tasks to see the other available tasks.

📝 Licence

MIT

About

An action which adds reviewers to the pull request when the pull request is opened.

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages