Skip to content

Commit f102270

Browse files
authored
[actions] update sandpaper workflow to version 0.16.9
1 parent 8703241 commit f102270

10 files changed

+63
-51
lines changed

.github/workflows/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This directory contains workflows to be used for Lessons using the {sandpaper}
44
lesson infrastructure. Two of these workflows require R (`sandpaper-main.yaml`
5-
and `pr-recieve.yaml`) and the rest are bots to handle pull request management.
5+
and `pr-receive.yaml`) and the rest are bots to handle pull request management.
66

77
These workflows will likely change as {sandpaper} evolves, so it is important to
88
keep them up-to-date. To do this in your lesson you can do the following in your
@@ -94,9 +94,9 @@ branch called `update/workflows` and a pull request is created. Maintainers are
9494
encouraged to review the changes and accept the pull request if the outputs
9595
are okay.
9696

97-
This update is run ~~weekly or~~ on demand.
97+
This update is run weekly or on demand.
9898

99-
### 03 Maintain: Update Pacakge Cache (update-cache.yaml)
99+
### 03 Maintain: Update Package Cache (update-cache.yaml)
100100

101101
For lessons that have generated content, we use {renv} to ensure that the output
102102
is stable. This is controlled by a single lockfile which documents the packages
@@ -140,7 +140,7 @@ Once the checks are finished, a comment is issued to the pull request, which
140140
will allow maintainers to determine if it is safe to run the
141141
"Receive Pull Request" workflow from new contributors.
142142

143-
### Recieve Pull Request (pr-recieve.yaml)
143+
### Receive Pull Request (pr-receive.yaml)
144144

145145
**Note of caution:** This workflow runs arbitrary code by anyone who creates a
146146
pull request. GitHub has safeguarded the token used in this workflow to have no
@@ -171,7 +171,7 @@ The artifacts produced are used by the next workflow.
171171

172172
### Comment on Pull Request (pr-comment.yaml)
173173

174-
This workflow is triggered if the `pr-recieve.yaml` workflow is successful.
174+
This workflow is triggered if the `pr-receive.yaml` workflow is successful.
175175
The steps in this workflow are:
176176

177177
1. Test if the workflow is valid and comment the validity of the workflow to the

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ on:
88
jobs:
99
send-close-signal:
1010
name: "Send closing signal"
11-
runs-on: ubuntu-latest
11+
runs-on: ubuntu-22.04
1212
if: ${{ github.event.action == 'closed' }}
1313
steps:
1414
- name: "Create PRtifact"
1515
run: |
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@v4
2020
with:
21-
name: pr
21+
name: pr
2222
path: ./pr
23-

.github/workflows/pr-comment.yaml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ jobs:
2020
# - no .github files were committed
2121
test-pr:
2222
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' &&
2626
github.event.workflow_run.conclusion == 'success'
2727
outputs:
2828
is_valid: ${{ steps.check-pr.outputs.VALID }}
@@ -74,13 +74,15 @@ jobs:
7474
create-branch:
7575
name: "Create Git Branch"
7676
needs: test-pr
77-
runs-on: ubuntu-latest
77+
runs-on: ubuntu-22.04
7878
if: ${{ needs.test-pr.outputs.is_valid == 'true' }}
7979
env:
8080
NR: ${{ needs.test-pr.outputs.number }}
81+
permissions:
82+
contents: write
8183
steps:
8284
- name: 'Checkout md outputs'
83-
uses: actions/checkout@v3
85+
uses: actions/checkout@v4
8486
with:
8587
ref: md-outputs
8688
path: built
@@ -104,9 +106,9 @@ jobs:
104106
git config --local user.name "GitHub Actions"
105107
CURR_HEAD=$(git rev-parse HEAD)
106108
git checkout --orphan md-outputs-PR-${NR}
107-
git add -A
109+
git add -A
108110
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 '_'
110112
cd ..
111113
unzip -o -d built built.zip
112114
cd built
@@ -118,18 +120,20 @@ jobs:
118120
comment-pr:
119121
name: "Comment on Pull Request"
120122
needs: [test-pr, create-branch]
121-
runs-on: ubuntu-latest
123+
runs-on: ubuntu-22.04
122124
if: ${{ needs.test-pr.outputs.is_valid == 'true' }}
123125
env:
124126
NR: ${{ needs.test-pr.outputs.number }}
127+
permissions:
128+
pull-requests: write
125129
steps:
126130
- name: 'Download comment artifact'
127131
id: dl
128132
uses: carpentries/actions/download-workflow-artifact@main
129133
with:
130134
run: ${{ github.event.workflow_run.id }}
131135
name: 'diff'
132-
136+
133137
- if: ${{ steps.dl.outputs.success == 'true' }}
134138
run: unzip ${{ github.workspace }}/diff.zip
135139

@@ -138,19 +142,21 @@ jobs:
138142
if: ${{ steps.dl.outputs.success == 'true' }}
139143
uses: carpentries/actions/comment-diff@main
140144
with:
141-
pr: ${{ env.NR }}
145+
pr: ${{ env.NR }}
142146
path: ${{ github.workspace }}/diff.md
143147

144148
# Comment if the PR is open and matches the SHA, but the workflow files have
145149
# changed
146150
comment-changed-workflow:
147151
name: "Comment if workflow files have changed"
148152
needs: test-pr
149-
runs-on: ubuntu-latest
153+
runs-on: ubuntu-22.04
150154
if: ${{ always() && needs.test-pr.outputs.is_valid == 'false' }}
151155
env:
152156
NR: ${{ github.event.workflow_run.pull_requests[0].number }}
153157
body: ${{ needs.test-pr.outputs.msg }}
158+
permissions:
159+
pull-requests: write
154160
steps:
155161
- name: 'Check for spoofing'
156162
id: dl
@@ -176,4 +182,3 @@ jobs:
176182
with:
177183
pr: ${{ env.NR }}
178184
body: ${{ env.body }}
179-

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ on:
99
jobs:
1010
delete:
1111
name: "Delete branch from Pull Request"
12-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-22.04
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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@ jobs:
1111
test-pr:
1212
name: "Test if pull request is valid"
1313
if: ${{ github.event.action != 'closed' }}
14-
runs-on: ubuntu-latest
14+
runs-on: ubuntu-22.04
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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
test-pr:
1414
name: "Record PR number"
1515
if: ${{ github.event.action != 'closed' }}
16-
runs-on: ubuntu-latest
16+
runs-on: ubuntu-22.04
1717
outputs:
1818
is_valid: ${{ steps.check-pr.outputs.VALID }}
1919
steps:
@@ -25,7 +25,7 @@ jobs:
2525
- name: "Upload PR number"
2626
id: upload
2727
if: ${{ always() }}
28-
uses: actions/upload-artifact@v2
28+
uses: actions/upload-artifact@v4
2929
with:
3030
name: pr
3131
path: ${{ github.workspace }}/NR
@@ -48,7 +48,7 @@ jobs:
4848
build-md-source:
4949
name: "Build markdown source files if valid"
5050
needs: test-pr
51-
runs-on: ubuntu-latest
51+
runs-on: ubuntu-22.04
5252
if: ${{ needs.test-pr.outputs.is_valid == 'true' }}
5353
env:
5454
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
@@ -58,10 +58,10 @@ jobs:
5858
MD: ${{ github.workspace }}/site/built
5959
steps:
6060
- name: "Check Out Main Branch"
61-
uses: actions/checkout@v3
61+
uses: actions/checkout@v4
6262

6363
- name: "Check Out Staging Branch"
64-
uses: actions/checkout@v3
64+
uses: actions/checkout@v4
6565
with:
6666
ref: md-outputs
6767
path: ${{ env.MD }}
@@ -107,20 +107,21 @@ jobs:
107107
shell: Rscript {0}
108108

109109
- name: "Upload PR"
110-
uses: actions/upload-artifact@v2
110+
uses: actions/upload-artifact@v4
111111
with:
112112
name: pr
113113
path: ${{ env.PR }}
114+
overwrite: true
114115

115116
- name: "Upload Diff"
116-
uses: actions/upload-artifact@v2
117+
uses: actions/upload-artifact@v4
117118
with:
118119
name: diff
119120
path: ${{ env.CHIVE }}
120121
retention-days: 1
121-
122+
122123
- name: "Upload Build"
123-
uses: actions/upload-artifact@v2
124+
uses: actions/upload-artifact@v4
124125
with:
125126
name: built
126127
path: ${{ env.MD }}

.github/workflows/sandpaper-main.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ on:
2121
jobs:
2222
full-build:
2323
name: "Build Full Site"
24-
runs-on: ubuntu-latest
24+
25+
# 2024-10-01: ubuntu-latest is now 24.04 and R is not installed by default in the runner image
26+
# pin to 22.04 for now
27+
runs-on: ubuntu-22.04
2528
permissions:
2629
checks: write
2730
contents: write
@@ -32,7 +35,7 @@ jobs:
3235
steps:
3336

3437
- name: "Checkout Lesson"
35-
uses: actions/checkout@v3
38+
uses: actions/checkout@v4
3639

3740
- name: "Set up R"
3841
uses: r-lib/actions/setup-r@v2
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.11.4
1+
0.16.9

.github/workflows/update-cache.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
jobs:
1515
preflight:
1616
name: "Preflight Check"
17-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-22.04
1818
outputs:
1919
ok: ${{ steps.check.outputs.ok }}
2020
steps:
@@ -36,14 +36,14 @@ jobs:
3636
3737
check_renv:
3838
name: "Check if We Need {renv}"
39-
runs-on: ubuntu-latest
39+
runs-on: ubuntu-22.04
4040
needs: preflight
4141
if: ${{ needs.preflight.outputs.ok == 'true'}}
4242
outputs:
4343
needed: ${{ steps.renv.outputs.exists }}
4444
steps:
4545
- name: "Checkout Lesson"
46-
uses: actions/checkout@v3
46+
uses: actions/checkout@v4
4747
- id: renv
4848
run: |
4949
if [[ -d renv ]]; then
@@ -52,7 +52,7 @@ jobs:
5252
5353
check_token:
5454
name: "Check SANDPAPER_WORKFLOW token"
55-
runs-on: ubuntu-latest
55+
runs-on: ubuntu-22.04
5656
needs: check_renv
5757
if: ${{ needs.check_renv.outputs.needed == 'true' }}
5858
outputs:
@@ -69,14 +69,14 @@ jobs:
6969
name: "Update Package Cache"
7070
needs: check_token
7171
if: ${{ needs.check_token.outputs.repo== 'true' }}
72-
runs-on: ubuntu-latest
72+
runs-on: ubuntu-22.04
7373
env:
7474
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
7575
RENV_PATHS_ROOT: ~/.local/share/renv/
7676
steps:
7777

7878
- name: "Checkout Lesson"
79-
uses: actions/checkout@v3
79+
uses: actions/checkout@v4
8080

8181
- name: "Set up R"
8282
uses: r-lib/actions/setup-r@v2
@@ -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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ on:
1818
jobs:
1919
check_token:
2020
name: "Check SANDPAPER_WORKFLOW token"
21-
runs-on: ubuntu-latest
21+
runs-on: ubuntu-22.04
2222
outputs:
2323
workflow: ${{ steps.validate.outputs.wf }}
2424
repo: ${{ steps.validate.outputs.repo }}
@@ -31,23 +31,23 @@ jobs:
3131

3232
update_workflow:
3333
name: "Update Workflow"
34-
runs-on: ubuntu-latest
34+
runs-on: ubuntu-22.04
3535
needs: check_token
3636
if: ${{ needs.check_token.outputs.workflow == 'true' }}
3737
steps:
3838
- name: "Checkout Repository"
39-
uses: actions/checkout@v3
39+
uses: actions/checkout@v4
4040

4141
- name: Update Workflows
4242
id: update
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)