pull_request_rules:
  # backports from main branch
  - name: backport main patches to stable branch
    conditions:
      - base=main
      - label=backport-to-stable
    actions:
      backport:
        branches:
          - stable

  - name: backport main patches to oldstable branch
    conditions:
      - base=main
      - label=backport-to-oldstable
    actions:
      backport:
        branches:
          - oldstable

  # backports from upcoming release branch
  - name: backport stable patches to main branch
    conditions:
      - base=stable
      - label=backport-to-main
    actions:
      backport:
        branches:
          - main

  - name: backport stable patches to oldstable branch
    conditions:
      - base=stable
      - label=backport-to-oldstable
    actions:
      backport:
        branches:
          - oldstable

  # backports from current release branch
  - name: backport oldstable patches to main branch
    conditions:
      - base=oldstable
      - label=backport-to-main
    actions:
      backport:
        branches:
          - main

  - name: backport oldstable patches to stable branch
    conditions:
      - base=oldstable
      - label=backport-to-stable
    actions:
      backport:
        branches:
          - stable
