Skip to content

Commit d70d15b

Browse files
authored
Fix backport GitHub Action for forks (#2284)
1 parent 5260ec5 commit d70d15b

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

.github/workflows/backport.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
11
name: Backport
22
on:
3-
pull_request:
3+
pull_request_target:
44
types:
55
- closed
66
- labeled
77

88
jobs:
99
backport:
10-
runs-on: ubuntu-latest
1110
name: Backport
11+
runs-on: ubuntu-latest
12+
# Only react to merged PRs for security reasons.
13+
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target.
14+
if: >
15+
github.event.pull_request.merged
16+
&& (
17+
github.event.action == 'closed'
18+
|| (
19+
github.event.action == 'labeled'
20+
&& contains(github.event.label.name, 'backport')
21+
)
22+
)
1223
steps:
13-
- name: Backport
14-
uses: tibdex/backport@v1
24+
- uses: tibdex/backport@9565281eda0731b1d20c4025c43339fb0a23812e # v2.0.4
1525
with:
1626
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)