New way of backporting to active branches using gh action (#17551)

This commit is contained in:
Yehor Shvedov 2025-04-15 00:39:38 +03:00 committed by GitHub
parent 2c95068e04
commit 86042f8c98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 36 additions and 56 deletions

22
.github/workflows/backport-active.yml vendored Normal file
View file

@ -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

View file

@ -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: ask to resolve conflict
# conditions:
@ -130,59 +144,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"
- "7.17"
labels:
- "backport"
title: "[{{ destination_branch }}] {{ title }} (backport #{{ number }})"