20
20
# - no .github files were committed
21
21
test-pr :
22
22
name : " Test if pull request is valid"
23
- runs-on : ubuntu-latest
24
- if : >
25
- github.event.workflow_run.event == 'pull_request' &&
23
+ runs-on : ubuntu-22.04
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 }}
@@ -74,13 +74,15 @@ jobs:
74
74
create-branch :
75
75
name : " Create Git Branch"
76
76
needs : test-pr
77
- runs-on : ubuntu-latest
77
+ runs-on : ubuntu-22.04
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
- uses : actions/checkout@v3
85
+ uses : actions/checkout@v4
84
86
with :
85
87
ref : md-outputs
86
88
path : built
@@ -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
@@ -118,18 +120,20 @@ jobs:
118
120
comment-pr :
119
121
name : " Comment on Pull Request"
120
122
needs : [test-pr, create-branch]
121
- runs-on : ubuntu-latest
123
+ runs-on : ubuntu-22.04
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,19 +142,21 @@ 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
145
149
# changed
146
150
comment-changed-workflow :
147
151
name : " Comment if workflow files have changed"
148
152
needs : test-pr
149
- runs-on : ubuntu-latest
153
+ runs-on : ubuntu-22.04
150
154
if : ${{ always() && needs.test-pr.outputs.is_valid == 'false' }}
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
@@ -176,4 +182,3 @@ jobs:
176
182
with :
177
183
pr : ${{ env.NR }}
178
184
body : ${{ env.body }}
179
-
0 commit comments