21
21
test-pr :
22
22
name : " Test if pull request is valid"
23
23
runs-on : ubuntu-latest
24
- if : >
25
- github.event.workflow_run.event == 'pull_request' &&
24
+ if : >
25
+ github.event.workflow_run.event == 'pull_request' &&
26
26
github.event.workflow_run.conclusion == 'success'
27
27
outputs :
28
28
is_valid : ${{ steps.check-pr.outputs.VALID }}
78
78
if : ${{ needs.test-pr.outputs.is_valid == 'true' }}
79
79
env :
80
80
NR : ${{ needs.test-pr.outputs.number }}
81
+ permissions :
82
+ contents : write
81
83
steps :
82
84
- name : ' Checkout md outputs'
83
85
uses : actions/checkout@v3
@@ -104,9 +106,9 @@ jobs:
104
106
git config --local user.name "GitHub Actions"
105
107
CURR_HEAD=$(git rev-parse HEAD)
106
108
git checkout --orphan md-outputs-PR-${NR}
107
- git add -A
109
+ git add -A
108
110
git commit -m "source commit: ${CURR_HEAD}"
109
- ls -A | grep -v '^.git$' | xargs rm -r
111
+ ls -A | grep -v '^.git$' | xargs -I _ rm -r '_'
110
112
cd ..
111
113
unzip -o -d built built.zip
112
114
cd built
@@ -122,14 +124,16 @@ jobs:
122
124
if : ${{ needs.test-pr.outputs.is_valid == 'true' }}
123
125
env :
124
126
NR : ${{ needs.test-pr.outputs.number }}
127
+ permissions :
128
+ pull-requests : write
125
129
steps :
126
130
- name : ' Download comment artifact'
127
131
id : dl
128
132
uses : carpentries/actions/download-workflow-artifact@main
129
133
with :
130
134
run : ${{ github.event.workflow_run.id }}
131
135
name : ' diff'
132
-
136
+
133
137
- if : ${{ steps.dl.outputs.success == 'true' }}
134
138
run : unzip ${{ github.workspace }}/diff.zip
135
139
@@ -138,7 +142,7 @@ jobs:
138
142
if : ${{ steps.dl.outputs.success == 'true' }}
139
143
uses : carpentries/actions/comment-diff@main
140
144
with :
141
- pr : ${{ env.NR }}
145
+ pr : ${{ env.NR }}
142
146
path : ${{ github.workspace }}/diff.md
143
147
144
148
# Comment if the PR is open and matches the SHA, but the workflow files have
@@ -151,6 +155,8 @@ jobs:
151
155
env :
152
156
NR : ${{ github.event.workflow_run.pull_requests[0].number }}
153
157
body : ${{ needs.test-pr.outputs.msg }}
158
+ permissions :
159
+ pull-requests : write
154
160
steps :
155
161
- name : ' Check for spoofing'
156
162
id : dl
0 commit comments