diff --git a/.github/workflows/backport-active.yml b/.github/workflows/backport-active.yml new file mode 100644 index 00000000..a0f563fe --- /dev/null +++ b/.github/workflows/backport-active.yml @@ -0,0 +1,22 @@ +name: Backport to active branches + +on: + pull_request_target: + types: [closed] + branches: + - main + +permissions: + pull-requests: write + contents: read + +jobs: + backport: + # Only run if the PR was merged (not just closed) and has one of the backport labels + if: | + github.event.pull_request.merged == true && + contains(toJSON(github.event.pull_request.labels.*.name), 'backport-active-') + runs-on: ubuntu-latest + + steps: + - uses: elastic/oblt-actions/github/backport-active@v1 diff --git a/.mergify.yml b/.mergify.yml index 5eaf72b8..28c00062 100644 --- a/.mergify.yml +++ b/.mergify.yml @@ -1,3 +1,17 @@ +commands_restrictions: + backport: + conditions: + - or: + - sender-permission>=write + - sender=github-actions[bot] +defaults: + actions: + backport: + title: "[{{ destination_branch }}] (backport #{{ number }}) {{ title }}" + assignees: + - "{{ author }}" + labels: + - "backport" pull_request_rules: - name: notify the backport policy conditions: @@ -107,58 +121,3 @@ pull_request_rules: labels: - "backport" title: "[{{ destination_branch }}] {{ title }} (backport #{{ number }})" - - - name: backport patches to all active minor branches for the 8 major. - conditions: - - merged - - label=backport-active-8 - actions: - backport: - assignees: - - "{{ author }}" - # NOTE: this list needs to be changed when a new minor branch is created - # or an existing minor branch reached EOL. - branches: - - "8.x" - - "8.18" - - "8.17" - - "8.16" - labels: - - "backport" - title: "[{{ destination_branch }}] {{ title }} (backport #{{ number }})" - - - name: backport patches to all active minor branches for the 9 major. - conditions: - - merged - - label=backport-active-9 - actions: - backport: - assignees: - - "{{ author }}" - # NOTE: this list needs to be changed when a new minor branch is created - # or an existing minor branch reached EOL. - branches: - - "9.0" - labels: - - "backport" - title: "[{{ destination_branch }}] {{ title }} (backport #{{ number }})" - - - name: backport patches to all active branches - conditions: - - merged - - label=backport-active-all - actions: - backport: - assignees: - - "{{ author }}" - # NOTE: this list needs to be changed when a new minor branch is created - # or an existing release branch reached EOL. - branches: - - "9.0" - - "8.18" - - "8.17" - - "8.16" - - "8.x" - labels: - - "backport" - title: "[{{ destination_branch }}] {{ title }} (backport #{{ number }})"