Skip to content

Commit 0075eca

Browse files
authored
New way of backporting to active branches using gh action (#282)
1 parent 532726b commit 0075eca

File tree

2 files changed

+36
-55
lines changed

2 files changed

+36
-55
lines changed

.github/workflows/backport-active.yml

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 & 55 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: notify the backport policy
317
conditions:
@@ -107,58 +121,3 @@ pull_request_rules:
107121
labels:
108122
- "backport"
109123
title: "[{{ destination_branch }}] {{ title }} (backport #{{ number }})"
110-
111-
- name: backport patches to all active minor branches for the 8 major.
112-
conditions:
113-
- merged
114-
- label=backport-active-8
115-
actions:
116-
backport:
117-
assignees:
118-
- "{{ author }}"
119-
# NOTE: this list needs to be changed when a new minor branch is created
120-
# or an existing minor branch reached EOL.
121-
branches:
122-
- "8.x"
123-
- "8.18"
124-
- "8.17"
125-
- "8.16"
126-
labels:
127-
- "backport"
128-
title: "[{{ destination_branch }}] {{ title }} (backport #{{ number }})"
129-
130-
- name: backport patches to all active minor branches for the 9 major.
131-
conditions:
132-
- merged
133-
- label=backport-active-9
134-
actions:
135-
backport:
136-
assignees:
137-
- "{{ author }}"
138-
# NOTE: this list needs to be changed when a new minor branch is created
139-
# or an existing minor branch reached EOL.
140-
branches:
141-
- "9.0"
142-
labels:
143-
- "backport"
144-
title: "[{{ destination_branch }}] {{ title }} (backport #{{ number }})"
145-
146-
- name: backport patches to all active branches
147-
conditions:
148-
- merged
149-
- label=backport-active-all
150-
actions:
151-
backport:
152-
assignees:
153-
- "{{ author }}"
154-
# NOTE: this list needs to be changed when a new minor branch is created
155-
# or an existing release branch reached EOL.
156-
branches:
157-
- "9.0"
158-
- "8.18"
159-
- "8.17"
160-
- "8.16"
161-
- "8.x"
162-
labels:
163-
- "backport"
164-
title: "[{{ destination_branch }}] {{ title }} (backport #{{ number }})"

0 commit comments

Comments
 (0)