Skip to content

Commit 4741270

Browse files
authored
Merge pull request #943 from swcarpentry/update/workflows
Update Workflows to Version 0.18.5
2 parents 081d18d + b55e466 commit 4741270

File tree

6 files changed

+34
-74
lines changed

6 files changed

+34
-74
lines changed

.github/workflows/docker_apply_cache.yaml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -208,20 +208,22 @@ jobs:
208208
restore-keys:
209209
${{ github.repository }}/${{ steps.wb-vers.outputs.container-version }}_renv-
210210

211-
trigger-build-deploy:
212-
name: "Trigger Build and Deploy Workflow"
211+
record-cache-result:
212+
name: "Record Caching Status"
213213
runs-on: ubuntu-latest
214-
needs: update-renv-cache
215-
if: |
216-
needs.update-renv-cache.result == 'success' ||
217-
needs.check-renv.outputs.renv-cache-available == 'true'
214+
needs: [check-renv, update-renv-cache]
215+
if: always()
216+
env:
217+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
218218
steps:
219-
- uses: actions/checkout@v4
219+
- name: "Record cache result"
220220

221-
- name: "Trigger Build and Deploy Workflow"
222-
env:
223-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
224221
run: |
225-
gh workflow run docker_build_deploy.yaml --ref main
222+
echo "${{ needs.update-renv-cache.result == 'success' || needs.check-renv.outputs.renv-cache-available == 'true' || 'false' }}" > ${{ github.workspace }}/apply-cache-result
226223
shell: bash
227-
continue-on-error: true
224+
225+
- name: "Upload cache result"
226+
uses: actions/upload-artifact@v4
227+
with:
228+
name: apply-cache-result
229+
path: ${{ github.workspace }}/apply-cache-result

.github/workflows/docker_build_deploy.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
- '.github/workbench-docker-version.txt'
1010
schedule:
1111
- cron: '0 0 * * 2'
12+
workflow_run:
13+
workflows: ["03 Maintain: Apply Package Cache"]
14+
types:
15+
- completed
1216
workflow_dispatch:
1317
inputs:
1418
name:
@@ -72,7 +76,6 @@ jobs:
7276
runs-on: ubuntu-latest
7377
needs: preflight
7478
if: |
75-
always() &&
7679
needs.preflight.outputs.do-build == 'true' &&
7780
needs.preflight.outputs.workbench-update != 'true'
7881
env:

.github/workflows/docker_pr_receive.yaml

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ permissions:
1919
pull-requests: write
2020

2121
jobs:
22-
2322
preflight:
2423
name: "Preflight: md-outputs exists?"
2524
runs-on: ubuntu-latest
@@ -49,7 +48,9 @@ jobs:
4948

5049
test-pr:
5150
name: "Record PR number"
52-
if: ${{ github.event.action != 'closed' }} && ${{ needs.preflight.outputs.branch-exists == 'true' }}
51+
if: |
52+
github.event.action != 'closed' &&
53+
needs.preflight.outputs.branch-exists == 'true'
5354
runs-on: ubuntu-latest
5455
needs: preflight
5556
outputs:
@@ -135,6 +136,7 @@ jobs:
135136
checks: write
136137
contents: write
137138
pages: write
139+
id-token: write
138140
container:
139141
image: ghcr.io/carpentries/workbench-docker:${{ vars.WORKBENCH_TAG || 'latest' }}
140142
env:
@@ -279,24 +281,3 @@ jobs:
279281
- name: "Teardown"
280282
run: sandpaper::reset_site()
281283
shell: Rscript {0}
282-
283-
pr-checks:
284-
name: "Trigger PR Checks?"
285-
needs:
286-
- test-pr
287-
- build-md-source
288-
runs-on: ubuntu-latest
289-
if: needs.test-pr.outputs.is_valid == 'true'
290-
permissions:
291-
actions: write
292-
checks: write
293-
steps:
294-
- name: "Checkout Lesson"
295-
uses: actions/checkout@v4
296-
297-
- name: "Trigger PR Checks"
298-
env:
299-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
300-
run: |
301-
gh workflow run pr-comment.yaml --ref main --field workflow_id=${{ github.run_id }}
302-
shell: bash

.github/workflows/pr-comment.yaml

Lines changed: 10 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
name: "Bot: Comment on the Pull Request"
22
description: "Comment on the pull request with the results of the markdown generation"
33
on:
4-
workflow_dispatch:
5-
inputs:
6-
workflow_id:
7-
required: true
8-
9-
concurrency:
10-
group: pr-${{ github.event.workflow_run.pull_requests[0].number }}
11-
cancel-in-progress: true
4+
workflow_run:
5+
workflows: ["Bot: Receive Pull Request"]
6+
types:
7+
- completed
128

139
jobs:
1410
# Pull requests are valid if:
@@ -18,16 +14,6 @@ jobs:
1814
test-pr:
1915
name: "Test if pull request is valid"
2016
runs-on: ubuntu-latest
21-
if: >
22-
github.event_name == 'workflow_dispatch' ||
23-
(
24-
github.event_name == 'workflow_run' &&
25-
(
26-
github.event.workflow_run.event == 'pull_request' ||
27-
github.event.workflow_run.event == 'workflow_dispatch'
28-
) &&
29-
github.event.workflow_run.conclusion == 'success'
30-
)
3117
outputs:
3218
is_valid: ${{ steps.check-pr.outputs.VALID }}
3319
payload: ${{ steps.check-pr.outputs.payload }}
@@ -38,7 +24,7 @@ jobs:
3824
id: dl
3925
uses: carpentries/actions/download-workflow-artifact@main
4026
with:
41-
run: ${{ github.event.workflow_run.id || inputs.workflow_id }}
27+
run: ${{ github.event.workflow_run.id }}
4228
name: 'pr'
4329

4430
- name: "Get PR Number"
@@ -79,11 +65,9 @@ jobs:
7965

8066
- name: "Skip checks for Workbench version file updates"
8167
if: steps.changed-files.outputs.only_version_file == 'true'
82-
env:
83-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8468
run: |
85-
echo "Only workbench-docker-version.txt changed, skipping preflight checks and running cache update"
86-
gh workflow run update-cache.yaml --ref main
69+
echo "# 🔧 Wait for Next Cache Update #"
70+
echo "Only workbench-docker-version.txt changed."
8771
exit 0
8872
shell: bash
8973

@@ -138,7 +122,7 @@ jobs:
138122
id: dl
139123
uses: carpentries/actions/download-workflow-artifact@main
140124
with:
141-
run: ${{ github.event.workflow_run.id || inputs.workflow_id }}
125+
run: ${{ github.event.workflow_run.id }}
142126
name: 'built'
143127

144128
- if: steps.dl.outputs.success == 'true'
@@ -177,7 +161,7 @@ jobs:
177161
id: dl
178162
uses: carpentries/actions/download-workflow-artifact@main
179163
with:
180-
run: ${{ github.event.workflow_run.id || inputs.workflow_id }}
164+
run: ${{ github.event.workflow_run.id }}
181165
name: 'diff'
182166

183167
- if: steps.dl.outputs.success == 'true'
@@ -210,7 +194,7 @@ jobs:
210194
id: dl
211195
uses: carpentries/actions/download-workflow-artifact@main
212196
with:
213-
run: ${{ github.event.workflow_run.id || inputs.workflow_id }}
197+
run: ${{ github.event.workflow_run.id }}
214198
name: 'built'
215199

216200
- name: "Alert if spoofed"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.18.4
1+
0.18.5

.github/workflows/update-cache.yaml

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ jobs:
154154
steps.update.outputs.n > 0
155155
uses: carpentries/create-pull-request@main
156156
with:
157-
token: ${{ steps.set-pat.outputs.pat || secrets.SANDPAPER_WORKFLOW || secrets.GITHUB_TOKEN }}
157+
token: ${{ steps.set-pat.outputs.pat || secrets.SANDPAPER_WORKFLOW }}
158158
delete-branch: true
159159
branch: "update/packages"
160160
commit-message: "[actions] update ${{ steps.update.outputs.n }} packages"
@@ -188,13 +188,3 @@ jobs:
188188
run: |
189189
echo "No updates needed, skipping PR creation"
190190
shell: bash
191-
192-
# thanks @Bisaloo! - https://github.com/carpentries/sandpaper/issues/646#issuecomment-2829578435
193-
# only trigger checks manually if the validate-token step had no valid AWS or SANDPAPER_WORKFLOW token
194-
- name: "Trigger checks"
195-
if: |
196-
steps.cpr.outputs.pull-request-number != '' &&
197-
steps.validate-org-workflow.outputs.is_valid != 'true'
198-
run: |
199-
gh workflow run docker_pr_receive.yaml --field pr_number=${{ steps.cpr.outputs.pull-request-number }}
200-
shell: bash

0 commit comments

Comments
 (0)