Giter Club home page Giter Club logo

Comments (3)

bluekeyes avatar bluekeyes commented on June 17, 2024 1

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.

bluekeyes avatar bluekeyes commented on June 17, 2024

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.

gpadavala avatar gpadavala commented on June 17, 2024
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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.