@@ -2,15 +2,34 @@ name: Pull request feedback
2
2
3
3
on :
4
4
pull_request_target :
5
- types : [ opened, synchronize ]
5
+ types : [ opened, synchronize, labeled ]
6
6
7
7
jobs :
8
8
test :
9
9
runs-on : ubuntu-latest
10
10
env :
11
11
GITHUB_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
12
12
steps :
13
- - uses : actions/checkout@v2
13
+ # owner-test just checks out the PR -- this has an exfiltration risk, make SURE that
14
+ # this can only be triggered by people with repo write access -- such as people that can add
15
+ # labels to a PR
16
+ # https://securitylab.github.com/research/github-actions-preventing-pwn-requests
17
+ - name : Checkout repo for OWNER TEST
18
+ uses : actions/checkout@v2
19
+ if : contains(github.event.pull_request.labels.*.name, 'safe to test')
20
+ with :
21
+ ref : ${{ github.event.pull_request.head.sha }}
22
+
23
+ # otherwise, checkout the current master, and the pr to the subdirectory 'pr'
24
+ - name : Checkout base repo for pull-request test
25
+ uses : actions/checkout@v2
26
+ if : " ! contains(github.event.pull_request.labels.*.name, 'safe to test')"
27
+ - name : Checkout pull-request
28
+ uses : actions/checkout@v2
29
+ if : " ! contains(github.event.pull_request.labels.*.name, 'safe to test')"
30
+ with :
31
+ path : pull-request
32
+ ref : ${{ github.event.pull_request.head.sha }}
14
33
15
34
- name : Check for relevant changes
16
35
uses : dorny/paths-filter@v2
@@ -29,34 +48,26 @@ jobs:
29
48
echo changed: ${{ steps.changed.outputs.style_files }} ${{ steps.changed.outputs.locale_files }}
30
49
31
50
- name : Set up Ruby
32
- if : steps.changed.outputs.style == 'true' || steps.changed.outputs.locale == 'true'
33
51
uses : ruby/setup-ruby@v1
34
52
with :
35
53
ruby-version : 2.7.1
36
54
- name : but use cache to speed that up
37
- if : steps.changed.outputs.style == 'true' || steps.changed.outputs.locale == 'true'
38
55
uses : actions/cache@v2
39
56
with :
40
57
path : vendor/bundle
41
58
key : ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
42
59
restore-keys : |
43
60
${{ runner.os }}-gems-
44
61
- name : Bundle install
45
- if : steps.changed.outputs.style == 'true' || steps.changed.outputs.locale == 'true'
46
62
run : |
47
63
bundle config path vendor/bundle
48
64
bundle update sheldon --jobs 4 --retry 3
49
65
50
- - name : Apply the PR
51
- if : steps.changed.outputs.style == 'true' || steps.changed.outputs.locale == 'true'
52
- run : bundle exec sheldon --token=$GITHUB_TOKEN --apply
53
-
54
66
- name : Welcome to a new PR
55
67
if : github.event.action == 'opened' && steps.changed.outputs.style == 'true'
56
68
run : bundle exec sheldon --token=$GITHUB_TOKEN --welcome
57
69
58
70
- name : See if the styles/locales work
59
- if : steps.changed.outputs.style == 'true' || steps.changed.outputs.locale == 'true'
60
71
run : bundle exec rake
61
72
62
73
- name : report
0 commit comments