Skip to content

Commit 86042f8

Browse files
authored
New way of backporting to active branches using gh action (#17551)
1 parent 2c95068 commit 86042f8

File tree

2 files changed

+36
-56
lines changed

2 files changed

+36
-56
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Backport to active branches
2+
3+
on:
4+
pull_request_target:
5+
types: [closed]
6+
branches:
7+
- main
8+
9+
permissions:
10+
pull-requests: write
11+
contents: read
12+
13+
jobs:
14+
backport:
15+
# Only run if the PR was merged (not just closed) and has one of the backport labels
16+
if: |
17+
github.event.pull_request.merged == true &&
18+
contains(toJSON(github.event.pull_request.labels.*.name), 'backport-active-')
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- uses: elastic/oblt-actions/github/backport-active@v1

.mergify.yml

Lines changed: 14 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
commands_restrictions:
2+
backport:
3+
conditions:
4+
- or:
5+
- sender-permission>=write
6+
- sender=github-actions[bot]
7+
defaults:
8+
actions:
9+
backport:
10+
title: "[{{ destination_branch }}] (backport #{{ number }}) {{ title }}"
11+
assignees:
12+
- "{{ author }}"
13+
labels:
14+
- "backport"
115
pull_request_rules:
216
# - name: ask to resolve conflict
317
# conditions:
@@ -130,59 +144,3 @@ pull_request_rules:
130144
labels:
131145
- "backport"
132146
title: "[{{ destination_branch }}] {{ title }} (backport #{{ number }})"
133-
134-
- name: backport patches to all active minor branches for the 8 major.
135-
conditions:
136-
- merged
137-
- label=backport-active-8
138-
actions:
139-
backport:
140-
assignees:
141-
- "{{ author }}"
142-
# NOTE: this list needs to be changed when a new minor branch is created
143-
# or an existing minor branch reached EOL.
144-
branches:
145-
- "8.x"
146-
- "8.18"
147-
- "8.17"
148-
- "8.16"
149-
labels:
150-
- "backport"
151-
title: "[{{ destination_branch }}] {{ title }} (backport #{{ number }})"
152-
153-
- name: backport patches to all active minor branches for the 9 major.
154-
conditions:
155-
- merged
156-
- label=backport-active-9
157-
actions:
158-
backport:
159-
assignees:
160-
- "{{ author }}"
161-
# NOTE: this list needs to be changed when a new minor branch is created
162-
# or an existing minor branch reached EOL.
163-
branches:
164-
- "9.0"
165-
labels:
166-
- "backport"
167-
title: "[{{ destination_branch }}] {{ title }} (backport #{{ number }})"
168-
169-
- name: backport patches to all active branches
170-
conditions:
171-
- merged
172-
- label=backport-active-all
173-
actions:
174-
backport:
175-
assignees:
176-
- "{{ author }}"
177-
# NOTE: this list needs to be changed when a new minor branch is created
178-
# or an existing release branch reached EOL.
179-
branches:
180-
- "9.0"
181-
- "8.18"
182-
- "8.17"
183-
- "8.16"
184-
- "8.x"
185-
- "7.17"
186-
labels:
187-
- "backport"
188-
title: "[{{ destination_branch }}] {{ title }} (backport #{{ number }})"

0 commit comments

Comments
 (0)