Skip to content

Commit 6a9193d

Browse files
AMoo-MikiAjay Gupta
authored andcommitted
Prevent backport workflow from running on umerged PRs (opensearch-project#2746)
Signed-off-by: Miki <[email protected]> Signed-off-by: Miki <[email protected]> Signed-off-by: Ajay Gupta <[email protected]>
1 parent 3a950f6 commit 6a9193d

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)