@@ -3,6 +3,8 @@ name: testing
3
3
on :
4
4
push :
5
5
pull_request :
6
+ pull_request_target :
7
+ types : [labeled]
6
8
workflow_dispatch :
7
9
8
10
jobs :
12
14
#
13
15
# The main trick is described here:
14
16
# https://github.com/Dart-Code/Dart-Code/pull/2375
15
- if : github.event_name == 'push' ||
16
- github.event.pull_request.head.repo.full_name != github.repository
17
+ #
18
+ # Also we want to run it always for manually triggered workflows.
19
+ if : (github.event_name == 'push') ||
20
+ (github.event_name == 'pull_request' &&
21
+ github.event.pull_request.head.repo.full_name != github.repository) ||
22
+ (github.event_name == 'workflow_dispatch')
17
23
18
24
runs-on : ubuntu-latest
19
25
65
71
run : make bench-deps bench DURATION=1x COUNT=1
66
72
67
73
run-tests-ee :
68
- if : github.event_name == 'push' ||
69
- github.event.pull_request.head.repo.full_name != github.repository
74
+ # The same as for run-tests-ce, but it does not run on pull requests from
75
+ # forks by default. Tests will run only when the pull request is labeled
76
+ # with `full-ci`. To avoid security problems, the label must be reset
77
+ # manually for every run.
78
+ #
79
+ # We need to use `pull_request_target` because it has access to base
80
+ # repository secrets unlike `pull_request`.
81
+ if : (github.event_name == 'push') ||
82
+ (github.event_name == 'pull_request_target' &&
83
+ github.event.pull_request.head.repo.full_name != github.repository &&
84
+ github.event.label.name == 'full-ci') ||
85
+ (github.event_name == 'workflow_dispatch')
70
86
71
87
runs-on : ubuntu-latest
72
88
@@ -86,6 +102,13 @@ jobs:
86
102
steps :
87
103
- name : Clone the connector
88
104
uses : actions/checkout@v2
105
+ # This is needed for pull_request_target because this event runs in the
106
+ # context of the base commit of the pull request. It works fine for
107
+ # `push` and `workflow_dispatch` because the default behavior is used
108
+ # if `ref` and `repository` are empty.
109
+ with :
110
+ ref : ${{github.event.pull_request.head.ref}}
111
+ repository : ${{github.event.pull_request.head.repo.full_name}}
89
112
90
113
- name : Setup Tarantool ${{ matrix.sdk-version }}
91
114
run : |
0 commit comments