{"id":23532468,"url":"https://github.com/necojackarc/auto-request-review","last_synced_at":"2025-05-16T11:06:25.579Z","repository":{"id":42715590,"uuid":"290291588","full_name":"necojackarc/auto-request-review","owner":"necojackarc","description":"A GitHub Action that automatically requests review of a pull request based on files changes and/or groups the author belongs to 🤖","archived":false,"fork":false,"pushed_at":"2025-02-18T23:34:28.000Z","size":357,"stargazers_count":134,"open_issues_count":29,"forks_count":34,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T08:17:54.608Z","etag":null,"topics":["code-review","github","github-actions","glob","pull-requests","request-review"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/auto-request-review","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/necojackarc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-25T18:23:24.000Z","updated_at":"2025-04-11T11:35:28.000Z","dependencies_parsed_at":"2023-12-28T01:00:34.566Z","dependency_job_id":"5c3828c9-396b-409a-9411-03b14bcedc07","html_url":"https://github.com/necojackarc/auto-request-review","commit_stats":{"total_commits":83,"total_committers":16,"mean_commits":5.1875,"dds":0.6024096385542168,"last_synced_commit":"5864393c75fa9ec875820992587e56683c2df31d"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/necojackarc%2Fauto-request-review","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/necojackarc%2Fauto-request-review/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/necojackarc%2Fauto-request-review/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/necojackarc%2Fauto-request-review/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/necojackarc","download_url":"https://codeload.github.com/necojackarc/auto-request-review/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248654045,"owners_count":21140236,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-review","github","github-actions","glob","pull-requests","request-review"],"created_at":"2024-12-25T23:10:48.404Z","updated_at":"2025-05-16T11:06:20.564Z","avatar_url":"https://github.com/necojackarc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Auto Request Review\n\n![CI](https://github.com/necojackarc/auto-request-review/workflows/CI/badge.svg)\n[![Coverage Status](https://coveralls.io/repos/github/necojackarc/auto-request-review/badge.svg?branch=master)](https://coveralls.io/github/necojackarc/auto-request-review?branch=master)\n\nA GitHub Action automatically requests review of a pull request based on files changes and/or groups the author belongs to 🤖\n\n## Motivation\nIt varies depending on the team who should review which pull requests. In some teams, review requests are randomly assigned while others prefer to have them reviewed by every one of the team members. With the default features, [code review assignments](https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/managing-code-review-assignment-for-your-team) and [code owners](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners), you can cover only a couple of use cases - in other words, there are other cases they don't cover.\n\nThis GitHub Action best suits any of the following needs:\n\n- You'd like to request review based on files changed\n- You'd like to specify reviewers per author\n- You'd like to get all of the other team members to review\n- You'd like to keep code owners real code owners, not just reviewers\n- You'd like to randomly pick reviewers based on the conditions mentioned above\n\nOverall, if you'd like to request review to a certain set of members based on groups and/or files changed, this GitHub Action works best.\n\n### Code owners vs reviewers\nCode owners own or are responsible for the code in their spaces while reviewers just review it. Some teams distinguish them clearly. For instance, in some teams, you need to get in total two approvals to merge your pull request; one is from one of the code owners and the other is from any of your team members. Another use case is that you'd like certain members to have a look if time permits as an optional and additional review while the code owners have to review it.\n\n## Notable Features\nThis GitHub Action enables you to:\n\n- Auto-assign reviewers based on files changed\n- Auto-assign reviewers based on the author\n- Auto-assign reviewers based on groups that the author belongs to\n- Auto-assign the default reviewers if no reviewers are matched to your rules\n- Randomly pick reviewers from matching reviewers\n- Request review only in certain conditions\n\n###  Auto-assign reviewers based on files changed\nYou can define reviewers based on files using [glob](https://en.wikipedia.org/wiki/Glob_(programming)) expressions.\n\n```yaml\nfiles:\n  '**/*.js':\n    - js-lovers\n```\n\n### Auto-assign reviewers based on the author\nYou can specify reviewers per author.\n\n```yaml\nreviewers:\n  groups:\n    engineers:\n      - engineer_a\n      - engineer_b\n\n  per_author:\n    engineers:\n      - engineers\n    designer_a:\n      - lead_designer\n    designer_b:\n      - lead_desinger\n      - desinger_a\n```\n\n### Auto-assign reviewers based on groups that the author belongs to\nIf you enable the group assignment feature, you can request code review to all of the other members of the groups you belong to.\n\n```yaml\nreviewers:\n  groups:\n    js-lovers:\n      - js-man\n      - js-woman\n\noptions:\n  enable_group_assignment: true\n```\n\n### Auto-assign the default reviewers if no reviewers are matched to your rules\nYou can define the default reviewers who will be assigned when no reviewers are matched to your rules.\n\n```yaml\nreviewers:\n  defaults:\n    - repository-owners\n```\n\n### Randomly pick reviewers from matching reviewers\nYou can randomly assign reviewers out of those who meet the conditions you set (e.g. file changes, groups, etc.).\n\n```yaml\noptions:\n  number_of_reviewers: 3\n```\n\n### Request review only in certain conditions\nIf you don't like to have the pull requests considered not yet ready reviewed, you can set `ignore_draft` and `ignored_keywords` options.\n\nIf your pull request is a draft and `ignore_draft` is `true`, review requests won't be made. The same applies if your pull request title contains any of `ignored_keywords`.\n\n```yaml\noptions:\n  ignore_draft: true\n  ignored_keywords:\n    - DO NOT REVIEW\n```\n\n## Configuration\nYou need to prepare two YAML files for:\n\n- Reviewers configuration\n- Workflow configuration\n\n### Reviewers configuration\nCreate a configuration file where you can define code reviewers in [glob](https://en.wikipedia.org/wiki/Glob_(programming)) expressions. Internally, [minimatch](https://github.com/isaacs/minimatch) is used as a glob implementation.\n\nThe format of a configuration file is as follows:\n\n```yaml\nreviewers:\n  # The default reviewers\n  defaults:\n    - repository-owners # group\n    - octocat # username\n    - team:default-reviewers # GitHub team\n\n  # Reviewer groups each of which has a list of GitHub usernames\n  groups:\n    repository-owners:\n      - me # username\n      - you # username\n    core-contributors:\n      - good-boy # username\n      - good-girl # username\n    js-lovers:\n      - js-man # username\n      - js-woman # username\n\n  # Reviewers per author.\n  # Keys are reviewees, each of which has an array of reviewers.\n  per_author:\n    engineers:\n      - engineers # group\n      - team:engineering-managers # GitHub team\n    lead_designer:\n      - js-lovers # group\n      - desinger_a # username\n    designer_a:\n      - lead_designer # username\n    designer_b:\n      - lead_desinger # username\n      - desinger_a # username\n\nfiles:\n  # Keys are glob expressions.\n  # You can assign groups defined above as well as GitHub usernames.\n  '**':\n    - repository-owners # group\n    - team:external-reviewers # GitHub team\n  '**/*.js':\n    - core-contributors # group\n    - js-lovers # group\n  '**/*.yml':\n    - core-contributors # group\n    - yamler # username\n  '.github/**':\n    - octopus # username\n    - cat # username\n\noptions:\n  ignore_draft: true\n  ignored_keywords:\n    - DO NOT REVIEW\n  enable_group_assignment: false\n\n  # Randomly pick reviewers up to this number.\n  # Do not set this option if you'd like to assign all matching reviewers.\n  number_of_reviewers: 3\n\n  # If it's true, the last matching files-change pattern takes the most precedence (CODEOWNERS-compatible)\n  # See https://github.com/necojackarc/auto-request-review/pull/80 for more details.\n  last_files_match_only: false\n```\n\nThe default configuration file location is `.github/auto_request_review.yml` but you can override it in your workflow configuration file.\n\n### Workflow configuration\nCreate a workflow file in `.github/workflows` (e.g. `.github/workflows/auto_request_review.yml`):\n\n```yaml\nname: Auto Request Review\n\non:\n  pull_request:\n    types: [opened, ready_for_review, reopened]\n\njobs:\n  auto-request-review:\n    name: Auto Request Review\n    runs-on: ubuntu-latest\n    steps:\n      - name: Request review based on files changes and/or groups the author belongs to\n        uses: necojackarc/auto-request-review@v0.13.0\n        with:\n          token: ${{ secrets.GITHUB_TOKEN }}\n          config: .github/reviewers.yml # Config file location override\n          # Look for config locally during run instead of in repo.\n          # For instance, if you'd like to use a config file stored in external storage,\n          # you can fetch it before you run this action, then let this action pick it up with `use_local: true`.\n          # This defaults to false if not specified.\n          # See https://github.com/necojackarc/auto-request-review/issues/76 for more details.\n          use_local: true\n```\n\n### (Optional) GitHub Personal Access Token\n\nWhen the default `GITHUB_TOKEN` doesn't have the necessary permissions, you need to [create a new GitHub personal access token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token).\n\nFor instance, if you'd like to use [GitHub teams](https://docs.github.com/en/organizations/organizing-members-into-teams/about-teams) to specify reviewers, you need to make a new PAT because the default `GITHUB_TOKEN` doesn't have the permission to request a review from a team.\n\nThe PAT needs to have the `repo` scope and the account the PAT belongs to needs to have the write permission to the repository. Once you create a new PAT, set it as a secret in your repository.\n\nLet's say you have a `@your-awesome-org/happy-team` team and make a new secret `PAT_FOR_AUTO_REQUEST_REVIEW` with your PAT, the configurations files will look like:\n\n```yaml\nfiles:\n  '**':\n    - team:happy-team # GitHub team\n```\n\n```yaml\n        with:\n          token: ${{ secrets.PAT_FOR_AUTO_REQUEST_REVIEW }}\n```\n\n### Working with Forks\n\nBy default, forks do not have `write` access or permissions with workflows. However, for workflows that need `write` access to do menial tasks like make comments or add reviewers, the `pull_request_target` trigger can be used. This trigger gives forks `write` access for the workflows. You can read more about the [`pull_request_target` trigger here](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target).\n\nThe `pull_request_target` trigger works for both native branches as well as forks.\n\n```yaml\nname: Auto Request Review\n\non:\n  pull_request_target:\n```\n\n#### Dependabot compatibility\n\nNote that with the [recent change to GitHub Actions that are created by Dependabot](https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/), the `pull_request` event will no longer give access to your secrets to this action. Instead you will need to use the `pull_request_target` event. If you do this make sure to read [Keeping your GitHub Actions and workflows secure: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) to understand the risks involved.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnecojackarc%2Fauto-request-review","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnecojackarc%2Fauto-request-review","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnecojackarc%2Fauto-request-review/lists"}