---
defaults:
  actions:
    comment:
    merge:
      method: rebase
      rebase_fallback: merge
      strict: smart
      strict_method: rebase
    rebase:

pull_request_rules:
  - name: remove outdated approvals
    conditions:
      - base~=^(main)|(release-.+)$
    actions:
      dismiss_reviews:
        approved: true
        changes_requested: false
  - name: ask to resolve conflict
    conditions:
      - conflict
    actions:
      comment:
        # yamllint disable-line rule:truthy
        message: "This pull request now has conflicts with the target branch.
        Could you please resolve conflicts and force push the corrected
        changes? 🙏"
  - name: automatic merge
    conditions:
      - label!=DNM
      - base~=^(main)|(release-.+)$
      - "#approved-reviews-by>=2"
      - "#changes-requested-reviews-by=0"
      - "status-success=codespell"
      - "status-success=docker-build"
      - "status-success=golangci-lint"
      - "status-success=DCO"
    actions:
      merge: {}
      dismiss_reviews: {}
      delete_head_branch: {}
  - name: automatic merge PR having ready-to-merge label
    conditions:
      - label!=DNM
      - label=ready-to-merge
      - base~=^(main)|(release-.+)$
      - "#approved-reviews-by>=1"
      - "status-success=codespell"
      - "status-success=docker-build"
      - "status-success=golangci-lint"
      - "status-success=DCO"
    actions:
      merge: {}
      dismiss_reviews: {}
      delete_head_branch: {}
