Skip to content

Commit 79bc4f1

Browse files
authored
[actions] update sandpaper workflow to version 0.11.16
1 parent 30163c8 commit 79bc4f1

9 files changed

+48
-23
lines changed

.github/workflows/README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,11 @@ pull request. GitHub has safeguarded the token used in this workflow to have no
147147
priviledges in the repository, but we have taken precautions to protect against
148148
spoofing.
149149

150+
This workflow is triggered with every push to a pull request. If this workflow
151+
is already running and a new push is sent to the pull request, the workflow
152+
running from the previous push will be cancelled and a new workflow run will be
153+
started.
154+
150155
The first step of this workflow is to check if it is valid (e.g. that no
151156
workflow files have been modified). If there are workflow files that have been
152157
modified, a comment is made that indicates that the workflow is not run. If
@@ -160,7 +165,7 @@ request. This builds the content and uploads three artifacts:
160165
3. The rendered files (build)
161166

162167
Because this workflow builds generated content, it follows the same general
163-
process as the sandpaper-main workflow with the same caching mechanisms.
168+
process as the `sandpaper-main` workflow with the same caching mechanisms.
164169

165170
The artifacts produced are used by the next workflow.
166171

@@ -176,7 +181,7 @@ The steps in this workflow are:
176181
3. If it is valid: update the pull request comment with the summary of changes
177182

178183
Importantly: if the pull request is invalid, the branch is not created so any
179-
malicious code is not published.
184+
malicious code is not published.
180185

181186
From here, the maintainer can request changes from the author and eventually
182187
either merge or reject the PR. When this happens, if the PR was valid, the

.github/workflows/pr-close-signal.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ jobs:
1616
mkdir -p ./pr
1717
printf ${{ github.event.number }} > ./pr/NUM
1818
- name: Upload Diff
19-
uses: actions/upload-artifact@v2
19+
uses: actions/upload-artifact@v3
2020
with:
21-
name: pr
21+
name: pr
2222
path: ./pr
2323

.github/workflows/pr-comment.yaml

+18-6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ on:
88
types:
99
- completed
1010

11+
concurrency:
12+
group: pr-${{ github.event.workflow_run.pull_requests[0].number }}
13+
cancel-in-progress: true
14+
15+
1116
jobs:
1217
# Pull requests are valid if:
1318
# - they match the sha of the workflow run head commit
@@ -16,8 +21,8 @@ jobs:
1621
test-pr:
1722
name: "Test if pull request is valid"
1823
runs-on: ubuntu-latest
19-
if: >
20-
github.event.workflow_run.event == 'pull_request' &&
24+
if: >
25+
github.event.workflow_run.event == 'pull_request' &&
2126
github.event.workflow_run.conclusion == 'success'
2227
outputs:
2328
is_valid: ${{ steps.check-pr.outputs.VALID }}
@@ -58,6 +63,7 @@ jobs:
5863
with:
5964
pr: ${{ steps.get-pr.outputs.NUM }}
6065
sha: ${{ github.event.workflow_run.head_sha }}
66+
headroom: 3 # if it's within the last three commits, we can keep going, because it's likely rapid-fire
6167
invalid: ${{ fromJSON(steps.hash.outputs.json)[github.repository] }}
6268
fail_on_error: true
6369

@@ -72,6 +78,8 @@ jobs:
7278
if: ${{ needs.test-pr.outputs.is_valid == 'true' }}
7379
env:
7480
NR: ${{ needs.test-pr.outputs.number }}
81+
permissions:
82+
contents: write
7583
steps:
7684
- name: 'Checkout md outputs'
7785
uses: actions/checkout@v3
@@ -98,9 +106,9 @@ jobs:
98106
git config --local user.name "GitHub Actions"
99107
CURR_HEAD=$(git rev-parse HEAD)
100108
git checkout --orphan md-outputs-PR-${NR}
101-
git add -A
109+
git add -A
102110
git commit -m "source commit: ${CURR_HEAD}"
103-
ls -A | grep -v '^.git$' | xargs rm -r
111+
ls -A | grep -v '^.git$' | xargs -I _ rm -r '_'
104112
cd ..
105113
unzip -o -d built built.zip
106114
cd built
@@ -116,14 +124,16 @@ jobs:
116124
if: ${{ needs.test-pr.outputs.is_valid == 'true' }}
117125
env:
118126
NR: ${{ needs.test-pr.outputs.number }}
127+
permissions:
128+
pull-requests: write
119129
steps:
120130
- name: 'Download comment artifact'
121131
id: dl
122132
uses: carpentries/actions/download-workflow-artifact@main
123133
with:
124134
run: ${{ github.event.workflow_run.id }}
125135
name: 'diff'
126-
136+
127137
- if: ${{ steps.dl.outputs.success == 'true' }}
128138
run: unzip ${{ github.workspace }}/diff.zip
129139

@@ -132,7 +142,7 @@ jobs:
132142
if: ${{ steps.dl.outputs.success == 'true' }}
133143
uses: carpentries/actions/comment-diff@main
134144
with:
135-
pr: ${{ env.NR }}
145+
pr: ${{ env.NR }}
136146
path: ${{ github.workspace }}/diff.md
137147

138148
# Comment if the PR is open and matches the SHA, but the workflow files have
@@ -145,6 +155,8 @@ jobs:
145155
env:
146156
NR: ${{ github.event.workflow_run.pull_requests[0].number }}
147157
body: ${{ needs.test-pr.outputs.msg }}
158+
permissions:
159+
pull-requests: write
148160
steps:
149161
- name: 'Check for spoofing'
150162
id: dl

.github/workflows/pr-post-remove-branch.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
if: >
1414
github.event.workflow_run.event == 'pull_request' &&
1515
github.event.workflow_run.conclusion == 'success'
16+
permissions:
17+
contents: write
1618
steps:
1719
- name: 'Download artifact'
1820
uses: carpentries/actions/download-workflow-artifact@main

.github/workflows/pr-preflight.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
runs-on: ubuntu-latest
1515
outputs:
1616
is_valid: ${{ steps.check-pr.outputs.VALID }}
17+
permissions:
18+
pull-requests: write
1719
steps:
1820
- name: "Get Invalid Hashes File"
1921
id: hash

.github/workflows/pr-receive.yaml

+9-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
types:
66
[opened, synchronize, reopened]
77

8+
concurrency:
9+
group: ${{ github.ref }}
10+
cancel-in-progress: true
11+
812
jobs:
913
test-pr:
1014
name: "Record PR number"
@@ -21,7 +25,7 @@ jobs:
2125
- name: "Upload PR number"
2226
id: upload
2327
if: ${{ always() }}
24-
uses: actions/upload-artifact@v2
28+
uses: actions/upload-artifact@v3
2529
with:
2630
name: pr
2731
path: ${{ github.workspace }}/NR
@@ -103,20 +107,20 @@ jobs:
103107
shell: Rscript {0}
104108

105109
- name: "Upload PR"
106-
uses: actions/upload-artifact@v2
110+
uses: actions/upload-artifact@v3
107111
with:
108112
name: pr
109113
path: ${{ env.PR }}
110114

111115
- name: "Upload Diff"
112-
uses: actions/upload-artifact@v2
116+
uses: actions/upload-artifact@v3
113117
with:
114118
name: diff
115119
path: ${{ env.CHIVE }}
116120
retention-days: 1
117-
121+
118122
- name: "Upload Build"
119-
uses: actions/upload-artifact@v2
123+
uses: actions/upload-artifact@v3
120124
with:
121125
name: built
122126
path: ${{ env.MD }}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.10.8
1+
0.11.16

.github/workflows/update-cache.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ jobs:
9393
- name: Create Pull Request
9494
id: cpr
9595
if: ${{ steps.update.outputs.n > 0 }}
96-
uses: peter-evans/create-pull-request@v4.2.0
96+
uses: carpentries/create-pull-request@main
9797
with:
9898
token: ${{ secrets.SANDPAPER_WORKFLOW }}
9999
delete-branch: true
@@ -119,7 +119,7 @@ jobs:
119119
```
120120
121121
- Auto-generated by [create-pull-request][1] on ${{ steps.update.outputs.date }}
122-
123-
[1]: https://github.com/peter-evans/create-pull-request
122+
123+
[1]: https://github.com/carpentries/create-pull-request/tree/main
124124
labels: "type: package cache"
125125
draft: false

.github/workflows/update-workflows.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ jobs:
4343
uses: carpentries/actions/update-workflows@main
4444
with:
4545
clean: ${{ github.event.inputs.clean }}
46-
46+
4747
- name: Create Pull Request
4848
id: cpr
4949
if: "${{ steps.update.outputs.new }}"
50-
uses: peter-evans/create-pull-request@v4.2.0
50+
uses: carpentries/create-pull-request@main
5151
with:
5252
token: ${{ secrets.SANDPAPER_WORKFLOW }}
5353
delete-branch: true
@@ -60,7 +60,7 @@ jobs:
6060
Update Workflows from sandpaper version ${{ steps.update.outputs.old }} -> ${{ steps.update.outputs.new }}
6161
6262
- Auto-generated by [create-pull-request][1] on ${{ steps.update.outputs.date }}
63-
64-
[1]: https://github.com/peter-evans/create-pull-request
63+
64+
[1]: https://github.com/carpentries/create-pull-request/tree/main
6565
labels: "type: template and tools"
6666
draft: false

0 commit comments

Comments
 (0)