Skip to content

Commit 09609f9

Browse files
committed
Manually update workflows
1 parent af0b2ae commit 09609f9

9 files changed

Lines changed: 213 additions & 316 deletions

.github/workflows/README.md

Lines changed: 114 additions & 166 deletions
Large diffs are not rendered by default.

.github/workflows/docker_apply_cache.yaml

Lines changed: 42 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
needs: preflight
4444
if: needs.preflight.outputs.do-apply == 'true'
4545
permissions:
46-
id-token: write # OIDC permission required
46+
id-token: write
4747
outputs:
4848
renv-needed: ${{ steps.check-for-renv.outputs.renv-needed }}
4949
renv-cache-hashsum: ${{ steps.check-for-renv.outputs.renv-cache-hashsum }}
@@ -87,25 +87,46 @@ jobs:
8787
github.event_name == 'workflow_dispatch' ||
8888
(
8989
github.event.pull_request.merged == true &&
90-
contains(
91-
join(github.event.pull_request.labels.*.name, ','),
92-
'type: package cache'
90+
(
91+
(
92+
contains(
93+
join(github.event.pull_request.labels.*.name, ','),
94+
'type: package cache'
95+
) &&
96+
github.event.pull_request.head.ref == 'update/packages'
97+
)
98+
||
99+
(
100+
contains(
101+
join(github.event.pull_request.labels.*.name, ','),
102+
'type: workflows'
103+
) &&
104+
github.event.pull_request.head.ref == 'update/workflows'
105+
)
106+
||
107+
(
108+
contains(
109+
join(github.event.pull_request.labels.*.name, ','),
110+
'type: docker version'
111+
) &&
112+
github.event.pull_request.head.ref == 'update/workbench-docker-version'
113+
)
93114
)
94115
)
95116
)
96117
permissions:
97118
checks: write
98119
contents: write
99120
pages: write
100-
id-token: write # OIDC permission required
121+
id-token: write
101122
container:
102-
image: carpentries/workbench-docker:${{ vars.WORKBENCH_TAG || 'latest' }}
123+
image: ghcr.io/carpentries/workbench-docker:${{ vars.WORKBENCH_TAG || 'latest' }}
103124
env:
104125
WORKBENCH_PROFILE: "ci"
105126
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
106127
RENV_PATHS_ROOT: /home/rstudio/lesson/renv
107128
RENV_PROFILE: "lesson-requirements"
108-
RENV_VERSION: ${{ needs.prepare.outputs.renv-cache-hashsum }}
129+
RENV_VERSION: ${{ needs.check-renv.outputs.renv-cache-hashsum }}
109130
RENV_CONFIG_EXTERNAL_LIBRARIES: "/usr/local/lib/R/site-library"
110131
volumes:
111132
- ${{ github.workspace }}:/home/rstudio/lesson
@@ -187,37 +208,22 @@ jobs:
187208
restore-keys:
188209
${{ github.repository }}/${{ steps.wb-vers.outputs.container-version }}_renv-
189210

190-
- name: "List current cache objects in S3 bucket"
191-
uses: gsaraf/aws-s3-github-action@master
192-
env:
193-
role-to-assume: ${{ secrets.AWS_GH_OIDC_ARN }}
194-
aws-region: ${{ secrets.AWS_GH_OIDC_REGION }}
195-
if: |
196-
steps.upload-cache.outcome == 'success' &&
197-
steps.validate-org-workflow.outputs.is_valid == 'true' &&
198-
env.role-to-assume != '' &&
199-
env.aws-region != ''
200-
with:
201-
command: ls
202-
source: s3://workbench-docker-caches/${{ github.repository }}/
203-
aws_access_key_id: ${{ steps.aws-creds.outputs.aws-access-key-id }}
204-
aws_secret_access_key: ${{ steps.aws-creds.outputs.aws-secret-access-key }}
205-
aws_region: ${{ env.aws-region }}
206-
207-
# trigger the build deploy workflow if update-renv-cache was successful
208-
trigger-build-deploy:
209-
name: "Trigger Build and Deploy Workflow"
211+
record-cache-result:
212+
name: "Record Caching Status"
210213
runs-on: ubuntu-latest
211-
needs: update-renv-cache
212-
if: |
213-
needs.update-renv-cache.result == 'success'
214+
needs: [check-renv, update-renv-cache]
215+
if: always()
216+
env:
217+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
214218
steps:
215-
- uses: actions/checkout@v4
219+
- name: "Record cache result"
216220

217-
- name: "Trigger Build and Deploy Workflow"
218-
env:
219-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
220221
run: |
221-
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
222223
shell: bash
223-
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: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@ description: "Build and deploy the lesson site using the carpentries/workbench-d
33
on:
44
push:
55
branches:
6-
- main
6+
- 'main'
7+
- 'l10n_main'
8+
paths-ignore:
9+
- '.github/workflows/**.yaml'
10+
- '.github/workbench-docker-version.txt'
711
schedule:
812
- cron: '0 0 * * 2'
13+
workflow_run:
14+
workflows: ["03 Maintain: Apply Package Cache"]
15+
types:
16+
- completed
917
workflow_dispatch:
1018
inputs:
1119
name:
@@ -26,10 +34,6 @@ on:
2634
required: true
2735
default: false
2836
type: boolean
29-
# workflow_run:
30-
# workflows: ["03 Maintain: Apply Package Cache"]
31-
# types:
32-
# - completed
3337

3438
# only one build/deploy at a time
3539
concurrency:
@@ -73,7 +77,6 @@ jobs:
7377
runs-on: ubuntu-latest
7478
needs: preflight
7579
if: |
76-
always() &&
7780
needs.preflight.outputs.do-build == 'true' &&
7881
needs.preflight.outputs.workbench-update != 'true'
7982
env:
@@ -83,9 +86,9 @@ jobs:
8386
checks: write
8487
contents: write
8588
pages: write
86-
id-token: write # OIDC permission required
89+
id-token: write
8790
container:
88-
image: carpentries/workbench-docker:${{ vars.WORKBENCH_TAG || 'latest' }}
91+
image: ghcr.io/carpentries/workbench-docker:${{ vars.WORKBENCH_TAG || 'latest' }}
8992
env:
9093
WORKBENCH_PROFILE: "ci"
9194
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
@@ -128,8 +131,9 @@ jobs:
128131
id: build-and-deploy
129132
uses: carpentries/actions/build-and-deploy@main
130133
with:
131-
reset: ${{ github.event.inputs.reset || 'false' }}
134+
reset: ${{ vars.BUILD_RESET || github.event.inputs.reset || 'false' }}
132135
skip-manage-deps: ${{ github.event.inputs.force-skip-manage-deps == 'true' || steps.build-container-deps.outputs.renv-cache-available || steps.build-container-deps.outputs.backup-cache-used || 'false' }}
136+
lang-code: ${{ vars.LANG_CODE || '' }}
133137

134138
update-container-version:
135139
name: "Update container version used"
@@ -139,7 +143,7 @@ jobs:
139143
actions: write
140144
contents: write
141145
pull-requests: write
142-
id-token: write # OIDC permission required
146+
id-token: write
143147
if: |
144148
needs.preflight.outputs.do-build == 'true' &&
145149
(
@@ -151,6 +155,7 @@ jobs:
151155
uses: carpentries/actions/record-container-version@main
152156
with:
153157
CONTAINER_VER: ${{ needs.preflight.outputs.wb-vers }}
158+
AUTO_MERGE: ${{ vars.AUTO_MERGE_CONTAINER_VERSION_UPDATE || 'true' }}
154159
token: ${{ secrets.GITHUB_TOKEN }}
155160
role-to-assume: ${{ secrets.AWS_GH_OIDC_ARN }}
156161
aws-region: ${{ secrets.AWS_GH_OIDC_REGION }}

.github/workflows/docker_pr_receive.yaml

Lines changed: 8 additions & 48 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
@@ -38,18 +37,20 @@ jobs:
3837
else
3938
echo "exists=false" >> $GITHUB_OUTPUT
4039
echo "::error::md-outputs branch required but does not exist."
41-
echo "::error::Please merge any open package update PRs, and run the '03 Maintain: Apply Package Cache' and '01: Maintain: Build and Deploy Site' workflows."
40+
echo "::error::Please merge any open package update PRs to trigger the '03 Maintain: Apply Package Cache' and '01: Maintain: Build and Deploy Site' workflows."
4241
4342
echo "## ❌ ERROR: md-outputs branch required" >> $GITHUB_STEP_SUMMARY
44-
echo "Please merge any open package update PRs, and run the '03 Maintain: Apply Package Cache' and '01: Maintain: Build and Deploy Site' workflows." >> $GITHUB_STEP_SUMMARY
43+
echo "Please merge any open package update PRs to trigger the '03 Maintain: Apply Package Cache' and '01: Maintain: Build and Deploy Site' workflows." >> $GITHUB_STEP_SUMMARY
4544
4645
exit 1
4746
fi
4847
shell: bash
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,9 +136,9 @@ jobs:
135136
checks: write
136137
contents: write
137138
pages: write
138-
id-token: write # OIDC permission required
139+
id-token: write
139140
container:
140-
image: carpentries/workbench-docker:${{ vars.WORKBENCH_TAG || 'latest' }}
141+
image: ghcr.io/carpentries/workbench-docker:${{ vars.WORKBENCH_TAG || 'latest' }}
141142
env:
142143
WORKBENCH_PROFILE: "ci"
143144
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
@@ -150,6 +151,7 @@ jobs:
150151
options: --cpus 2
151152
outputs:
152153
workbench-update: ${{ steps.wb-vers.outputs.workbench-update }}
154+
build-site: ${{ steps.build-site.outcome }}
153155
steps:
154156
- uses: actions/checkout@v4
155157

@@ -279,45 +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
303-
304-
cache-update:
305-
name: "Trigger Update Cache Workflow?"
306-
needs:
307-
- check-renv
308-
- build-md-source
309-
runs-on: ubuntu-latest
310-
if: |
311-
needs.check-renv.outputs.renv-needed == 'true' &&
312-
needs.build-md-source.outputs.workbench-update == 'true' &&
313-
needs.build-md-source.build-site.outcome == 'success'
314-
permissions:
315-
actions: write
316-
checks: write
317-
steps:
318-
- name: "Trigger renv rebuild"
319-
env:
320-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
321-
run: |
322-
gh workflow run update-cache.yaml
323-
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"

.github/workflows/sandpaper-version.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)