Comments (3)
Try something like this:
policy:
approval:
- ops_review
- autoapproved
approval_rules:
- name: ops_review
description: Ops to approve production merge
requires:
count: 1
teams:
- OPS_TEAM
if:
targets_branch:
pattern: main
options:
invalidate_on_push: true
request_review:
enabled: true
mode: teams
- name: autoapproved
description: Changes to all branches are auto-approved
requires:
count: 0
For PRs targeting main
both conditions are required, so the ops team must approve. For all other PRs, the ops review condition is skipped and the second rule automatically approves.
from policy-bot.
When Policy Bot is enabled on a repository, it posts statuses for all PRs where the target branch of the PR contains a policy file. As you found, we require that every policy evaluation has a least one rule matching rule, to avoid accidentally approving things if there's a mistake or missed case in the policy.
The recommended way to fix this is to modify the policy to contain a rule that automatically approves all PRs made against other branches. If you're not sure how to do this, please share your policy and I might be able to help.
The other option is to delete the policy file from all branches except the main branch. This might not be possible if you regularly merge branches together.
from policy-bot.
policy:
approval:
- and:
- ops_review
approval_rules:
- name: ops_review
description: Ops to approve production merge
requires:
count: 1
teams:
- OPS_TEAM
if:
targets_branch:
pattern: main
options:
invalidate_on_push: true
request_review:
enabled: true
mode: teams
from policy-bot.
Related Issues (20)
- Allow '=' as comparison operator HOT 1
- Misleading documentation about file path regular expressions HOT 1
- AppID ENV Variable not respected HOT 2
- Confusing behavior with skipped checks. HOT 5
- Add feature to use request more reviewers than required count in case of random-users HOT 1
- [Question] Approval by teams agregator
- Declarative Testing of Policies HOT 5
- Certain merges can lead to ignored commits during evaluation
- Request for Advice on Using Policy Bot in Open Source Projects for Testing, Approving, Merging of PRs HOT 3
- If no rule matches can policy-bot not set a failed status on the PR? HOT 1
- Unable to run policy-bot behind a reverse-prxoy HOT 3
- `common.IsActor()` does not actually use `ctx` and can be simplified.
- Condition for not having specific label(s) HOT 6
- has_successful_status causes review requests while PR has draft status HOT 5
- Status check clarification HOT 2
- Feature Request: Predicate to skip rule if a file was changed HOT 6
- Feature Request: Option to count skipped jobs in has_successful_status HOT 5
- Clarify why users are "disqualified" when approval is ignored
- Create new production Release 🚀 HOT 1
- Connecting lines broken when hiding skipped rules with errors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from policy-bot.