Skip to content

Commit 724cb1a

Browse files
Prevent backport workflow from running on umerged PRs (#2746) (#2757)
Signed-off-by: Miki <[email protected]> Signed-off-by: Miki <[email protected]> (cherry picked from commit a3cbd30) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Signed-off-by: Miki <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent b60408b commit 724cb1a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

.github/workflows/backport.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ jobs:
1212
contents: write
1313
pull-requests: write
1414
name: Backport
15+
# Only react to merged PRs for security reasons.
16+
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
17+
if: >
18+
github.event.pull_request.merged
19+
&& (
20+
github.event.action == 'closed'
21+
|| (
22+
github.event.action == 'labeled'
23+
&& contains(github.event.label.name, 'backport')
24+
)
25+
)
1526
steps:
1627
- name: GitHub App token
1728
id: github_app_token

0 commit comments

Comments
 (0)