Skip to content

Commit 965c856

Browse files
authored
[CI] Fire scoped-rector dispatch on merged PR, not push (#774)
1 parent 8a896f7 commit 965c856

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎.github/workflows/dispatch_build_scoped_rector.yaml‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,25 @@
22
# with the freshly merged rector-phpunit main
33
name: Dispatch Build Scoped Rector
44

5+
# pull_request_target fires on merge even for fork PRs and, unlike "push",
6+
# is not suppressed when the merge commit is pushed with GITHUB_TOKEN
57
on:
6-
push:
7-
branches:
8-
- main
8+
pull_request_target:
9+
types:
10+
- closed
911
workflow_dispatch: null
1012

1113
jobs:
1214
dispatch_build_scoped_rector:
13-
# only for this repository, not forks
14-
if: github.repository == 'rectorphp/rector-phpunit'
15+
# only for this repository, not forks; and only on a merged PR (not a plain close)
16+
if: github.repository == 'rectorphp/rector-phpunit' && (github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true)
1517

1618
runs-on: ubuntu-latest
1719
timeout-minutes: 10
1820

1921
steps:
2022
-
21-
name: "Wait 20 seconds after push"
23+
name: "Wait 20 seconds after merge"
2224
run: sleep 20
2325

2426
-

0 commit comments

Comments
 (0)