Skip to content

Doist/auto-request-reviews-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Auto Request Reviews Action

A GitHub Action that automatically requests reviews in pull requests from members of a specified team, up to a designated number of reviewers.

Usage

name: Automatically request reviews

on:
  pull_request:
    types: [opened, ready_for_review, reopened]

jobs:
  request-reviews:
    runs-on: ubuntu-latest
    if: ${{ !github.event.pull_request.draft }}
    steps:
      - name: Automatically request reviews
        uses: doist/auto-request-reviews-action@v1
        with:
          reviewers: 2
          team: 'Doist/team'
          token: ${{ secrets.GITHUB_TOKEN }}

Inputs

Input Description Required
reviewers Desired total number of reviewers in total Yes
team Team to pick reviewers from (format: org/team) Yes
token GitHub token with required permissions (see Permissions) Yes

How it works

This action:

  1. Fetches the current pull request and counts how many reviewers are already requested
  2. Calculates how many more reviewers are needed to reach the specified number
  3. Gets all members of the specified team, excluding the PR author and existing reviewers
  4. Randomly selects the required number of reviewers from eligible team members
  5. If there aren't enough eligible team members, requests as many as possible and logs a warning

Permissions

This action requires that:

  1. You provide a token with repo and read:org permissions.
    The default GITHUB_TOKEN is insufficient because it lacks scopes for team member access.
  2. The token belongs to account with at least Triage permisisons on the repository.

Store the Perosnal Access Token (PAT) as a repository secret and pass it in your workflow.

Development

Setup

npm install

Build

npm run build

This project uses esbuild for bundling, which creates a single file with all dependencies included.

Lint & Format

# Run linter
npm run lint

# Format code
npm run format

This project uses Biome for both linting and formatting.

About

GitHub Action that automatically requests pull request reviews

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •