Skip to content

Commit d2baf9f

Browse files
authored
github-actions: support backport labels after being merged (#18102)
1 parent d9b95bf commit d2baf9f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/workflows/backport-active.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Backport to active branches
22

33
on:
44
pull_request_target:
5-
types: [closed]
5+
types: [closed, labeled]
66
branches:
77
- main
88

@@ -13,9 +13,13 @@ permissions:
1313
jobs:
1414
backport:
1515
# Only run if the PR was merged (not just closed) and has one of the backport labels
16+
# or has been added afterwards.
1617
if: |
17-
github.event.pull_request.merged == true &&
18-
contains(toJSON(github.event.pull_request.labels.*.name), 'backport-active-')
18+
github.event.pull_request.merged == true &&
19+
(
20+
(github.event.action == 'closed' && contains(toJSON(github.event.pull_request.labels.*.name), 'backport-active-')) ||
21+
(github.event.action == 'labeled' && startsWith(github.event.label.name, 'backport-active-'))
22+
)
1923
runs-on: ubuntu-latest
2024

2125
steps:

0 commit comments

Comments
 (0)