Require N number of PR approvals from members of a GitHub team. Used to enforce pre-merge PR checks more explicitly than GitHub's native CODEOWNERS
file.
View: Usage Examples | Parameters | Security | Changelog | License
The bare minimum configuration requires a GitHub access token with 'read:org' scope and the team name whose approval is required. The default number of approvals is set to 1 on the PR which triggered the workflow and can be called multiple times for different teams.
on:
pull_request:
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Require DEV team approval
uses: op5dev/require-team-approval@v1
with:
team: dev-team
token: ${{ secrets.CI_PAT }}
- name: Require QA team approval
uses: op5dev/require-team-approval@v1
with:
team: qa-team
token: ${{ secrets.CI_PAT }}
This configuration demonstrates a more targeted approach by checking for approvals only when an approved
review is submitted. The outputs provide detailed information about the approvals, both by the team and the PR in general, for use in subsequent steps as counts or named lists.
on:
pull_request_review:
types: [submitted]
jobs:
check:
if: github.event.review.state == 'approved'
runs-on: ubuntu-latest
steps:
- name: Require QA team approval x2
id: approval
uses: op5dev/require-team-approval@v1
with:
approvals: 2
team: qa-team
token: ${{ secrets.CI_PAT }}
- run: |
echo "Got ${{ steps.approval.outputs.team-approvals-count }} / 2 approvals from QA."
echo "Got ${{ steps.approval.outputs.pr-approvals-count }} approvals in total."
Name | Description |
---|---|
team (required) |
Team whose approval is required. Example: qa-team |
token (required) |
GitHub access token with 'read:org' scope. Example: secrets.CI_PAT |
approvals |
Count of approvals required. Default: 1 |
pr-number |
Override PR number. Example: 42 |
Name | Description |
---|---|
pr-approvals |
List of approvals on the PR. Example: [dev-1,qa-1] |
pr-approvals-count |
Count of approvals on the PR. Example: 1 |
team-approvals |
List of approvals from the team. Example: [qa-1] |
team-approvals-count |
Count of approvals from the team. Example: 1 |
team-members |
List of team members. Example: [dev-1,dev-2,dev-3] |
team-members-count |
Count of team members. Example: 1 |
View security policy and reporting instructions.
View all notable changes to this project in Keep a Changelog format, which adheres to Semantic Versioning.
Tip
All forms of contribution are very welcome and deeply appreciated for fostering open-source projects.
- Create a PR to contribute changes you'd like to see.
- Raise an issue to propose changes or report unexpected behavior.
- Open a discussion to discuss broader topics or questions.
- Become a stargazer if you find this project useful.
- This project is licensed under the permissive Apache License 2.0.
- All works herein are my own, shared of my own volition, and contributors.
- Copyright 2016-2025 Rishav Dhar — All wrongs reserved.