Skip to content

Instantly share code, notes, and snippets.

@Braunson
Created November 3, 2025 19:12
Show Gist options
  • Select an option

  • Save Braunson/923d991a4cccd0d45b3ed64bf95827dd to your computer and use it in GitHub Desktop.

Select an option

Save Braunson/923d991a4cccd0d45b3ed64bf95827dd to your computer and use it in GitHub Desktop.
GitHub workaround for Branch rulesets and requiring to subscribe to GitHub Team's. This is more of a strong suggestion rather than a hard block, it will still allow users with write permissions to merge the MR.
name: Require Review
on:
pull_request:
types: [opened, synchronize, reopened, review_requested]
pull_request_review:
types: [submitted, dismissed]
jobs:
check-approval:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
with:
script: |
const reviews = await github.rest.pulls.listReviews({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
});
const approved = reviews.data.some(r => r.state === 'APPROVED');
if (!approved) {
core.setFailed('❌ PR requires at least one approval');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment