Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add require multiple reviewers action #204

Merged
merged 5 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* text=auto eol=lf

**/dist/** -diff linguist-generated=true
dbjorge marked this conversation as resolved.
Show resolved Hide resolved
41 changes: 41 additions & 0 deletions .github/actions/require-multiple-reviewers-v1/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# require-multiple-reviewers-v1

A GitHub Action that requires multiple reviewers for important files

## Inputs

| Name | Required | Description | Default |
| ---------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| `token` | Yes | A GitHub token with the [required permissions](#permissions) | NA |
| `number-of-reviewers` | Yes | The number of reviewers required. | 2 |
| `important-files-path` | Yes | The path to the file containing a list of important files. It should comply with [gitignore syntax](https://git-scm.com/docs/gitignore). | NA |

## Example usage

```yaml
name: Require multiple reviewers

zlayaAvocado marked this conversation as resolved.
Show resolved Hide resolved
jobs:
require-multiple-reviewers:
runs-on: ubuntu-latest
timeout-minutes: 2
permissions:
pull-requests: read
contents: read
zlayaAvocado marked this conversation as resolved.
Show resolved Hide resolved
checks: write
steps:
zlayaAvocado marked this conversation as resolved.
Show resolved Hide resolved
- name: Require two reviewers for important files
uses: dequelabs/axe-api-team-public/.github/actions/require-multiple-reviewers-v1@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
zlayaAvocado marked this conversation as resolved.
Show resolved Hide resolved
number-of-reviewers: 2
important-files-path: .github/important-files.txt
```

## Permissions

This action requires the following permission scopes:

- `pull-requests: read` - To get pull request reviews.
- `contents: read` - To read the contents of the repository, including the changed and important files.
- `checks: write` - To create and update check runs with the results of the action.
19 changes: 19 additions & 0 deletions .github/actions/require-multiple-reviewers-v1/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Require multiple reviewers
description: Require multiple reviewers for important files

# Define your inputs here.
inputs:
token:
description: 'A GitHub token with the required permissions'
required: true
number-of-reviewers:
description: 'The number of reviewers required.'
required: true
default: '2'
important-files-path:
description: 'The path to the file containing a list of important files (gitignore syntax supported).'
required: true

runs:
using: node20
main: dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading