Skip to content

Commit a25d183

Browse files
committed
Tidying output messages, fixing some more logic
1 parent 329ca27 commit a25d183

5 files changed

Lines changed: 42 additions & 19 deletions

File tree

.github/workflows/docker_apply_cache.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
echo "This was not a manual trigger and no PR was merged. No action taken."
3131
echo "merged_or_manual=false" >> $GITHUB_OUTPUT
3232
fi
33+
shell: bash
3334

3435
check-renv:
3536
name: "Check If We Need {renv}"
@@ -112,10 +113,12 @@ jobs:
112113
ls -lah /home/rstudio/.workbench
113114
ls -lah $(pwd)
114115
Rscript -e 'sessionInfo()'
116+
shell: bash
115117

116118
- name: "Mark Repository as Safe"
117119
run: |
118120
git config --global --add safe.directory $(pwd)
121+
shell: bash
119122

120123
- name: "Ensure sandpaper is loadable"
121124
run: |
@@ -126,17 +129,20 @@ jobs:
126129
- name: "Setup Lesson Dependencies"
127130
run: |
128131
Rscript /home/rstudio/.workbench/setup_lesson_deps.R
132+
shell: bash
129133

130134
- name: "Fortify renv Cache"
131135
run: |
132136
Rscript /home/rstudio/.workbench/fortify_renv_cache.R
137+
shell: bash
133138

134139
- name: "Get Container Version Used"
135140
id: wb-vers
136141
uses: carpentries/actions/container-version@frog-s3-test-1
137142
with:
138143
WORKBENCH_TAG: ${{ vars.WORKBENCH_TAG }}
139144
renv-needed: ${{ needs.check-renv.outputs.renv-needed }}
145+
token: ${{ secrets.GITHUB_TOKEN }}
140146

141147
- name: "Validate Current Org and Workflow"
142148
id: validate-org-workflow

.github/workflows/docker_build_deploy.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ jobs:
6161
with:
6262
WORKBENCH_TAG: ${{ vars.WORKBENCH_TAG }}
6363
renv-needed: ${{ steps.build-check.outputs.renv-needed }}
64+
token: ${{ secrets.GITHUB_TOKEN }}
6465

6566
full-build:
6667
name: "Build Full Site"
@@ -100,10 +101,12 @@ jobs:
100101
ls -lah /home/rstudio/.workbench
101102
ls -lah $(pwd)
102103
Rscript -e 'sessionInfo()'
104+
shell: bash
103105

104106
- name: "Mark Repository as Safe"
105107
run: |
106108
git config --global --add safe.directory $(pwd)
109+
shell: bash
107110

108111
- name: "Setup Lesson Dependencies"
109112
id: build-container-deps
@@ -114,6 +117,7 @@ jobs:
114117
LESSON_PATH: ${{ vars.LESSON_PATH || '/home/rstudio/lesson' }}
115118
role-to-assume: ${{ secrets.AWS_GH_OIDC_ARN }}
116119
aws-region: ${{ secrets.AWS_GH_OIDC_REGION }}
120+
token: ${{ secrets.GITHUB_TOKEN }}
117121

118122
- name: "Run Container and Build Site"
119123
id: build-and-deploy
@@ -127,6 +131,7 @@ jobs:
127131
runs-on: ubuntu-latest
128132
needs: [preflight]
129133
permissions:
134+
actions: write # This is critical!
130135
contents: write
131136
pull-requests: write
132137
id-token: write # OIDC permission required

.github/workflows/docker_pr_receive.yaml

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,20 @@ jobs:
3131
- name: "Check if md-outputs branch exists"
3232
id: check
3333
run: |
34+
# 💡 Checking for md-outputs branch #
3435
if [[ -n $(git ls-remote --exit-code --heads origin md-outputs) ]]; then
3536
echo "exists=true" >> $GITHUB_OUTPUT
3637
else
3738
echo "exists=false" >> $GITHUB_OUTPUT
38-
echo "❌ md-outputs branch required. Please merge any open package update PRs, and run the '03 Maintain: Apply Package Cache' and '01: Maintain: Build and Deploy Site' workflows."
39+
echo "::error::md-outputs branch required but does not exist."
40+
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."
41+
42+
echo "## ❌ ERROR: md-outputs branch required" >> $GITHUB_STEP_SUMMARY
43+
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
44+
3945
exit 1
4046
fi
47+
shell: bash
4148

4249
test-pr:
4350
name: "Record PR number"
@@ -49,27 +56,24 @@ jobs:
4956
pr_number: ${{ env.NR }}
5057
pr_branch: ${{ env.PR_BRANCH }}
5158
steps:
52-
- name: "Auto: Grab PR"
53-
if: github.event_name == 'pull_request'
59+
- name: "Grab PR"
5460
env:
5561
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5662
run: |
57-
echo ${{ github.event.number }} > ${{ github.workspace }}/NR
58-
echo "NR=${{ github.event.number }}" >> $GITHUB_ENV
59-
echo "PR_BRANCH=$(gh -R ${{ github.repository }} pr view ${{ github.event.number }} --json headRefName --jq '.headRefName')" >> $GITHUB_ENV
63+
if [[ "${{ github.event_name }}" == "pull_request" ]] ; then
64+
PR_NUMBER=${{ github.event.number }}
65+
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]] ; then
66+
PR_NUMBER=${{ inputs.pr_number }}
67+
fi
6068
61-
- name: "Manual: Grab PR"
62-
if: ${{ github.event_name == 'workflow_dispatch' }}
63-
env:
64-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65-
run: |
66-
echo ${{ inputs.pr_number }} > ${{ github.workspace }}/NR
67-
echo "NR=${{ inputs.pr_number }}" >> $GITHUB_ENV
68-
echo "PR_BRANCH=$(gh -R ${{ github.repository }} pr view ${{ inputs.pr_number }} --json headRefName --jq '.headRefName')" >> $GITHUB_ENV
69+
echo $PR_NUMBER > ${{ github.workspace }}/NR
70+
echo "NR=$PR_NUMBER" >> $GITHUB_ENV
71+
echo "PR_BRANCH=$(gh -R ${{ github.repository }} pr view $PR_NUMBER --json headRefName --jq '.headRefName')" >> $GITHUB_ENV
72+
shell: bash
6973

7074
- name: "Upload PR number"
7175
id: upload
72-
if: ${{ always() }}
76+
if: always()
7377
uses: actions/upload-artifact@v4
7478
with:
7579
name: pr
@@ -81,10 +85,12 @@ jobs:
8185
echo "json<<EOF
8286
$(curl -sL https://files.carpentries.org/invalid-hashes.json)
8387
EOF" >> $GITHUB_OUTPUT
88+
shell: bash
8489

85-
- name: "echo output"
90+
- name: "Debug Hashes Output"
8691
run: |
8792
echo "${{ steps.hash.outputs.json }}"
93+
shell: bash
8894

8995
- name: "Check PR"
9096
id: check-pr
@@ -156,6 +162,7 @@ jobs:
156162
run: |
157163
git config --global --add safe.directory $(pwd)
158164
git config --global --add safe.directory /home/rstudio/lesson
165+
shell: bash
159166

160167
- name: "Ensure sandpaper is loadable"
161168
run: |
@@ -166,6 +173,7 @@ jobs:
166173
- name: Setup Lesson Dependencies
167174
run: |
168175
Rscript /home/rstudio/.workbench/setup_lesson_deps.R
176+
shell: bash
169177

170178
- name: Get Container Version Used
171179
id: wb-vers
@@ -174,6 +182,7 @@ jobs:
174182
with:
175183
WORKBENCH_TAG: ${{ vars.WORKBENCH_TAG }}
176184
renv-needed: ${{ needs.check-renv.outputs.renv-needed }}
185+
token: ${{ secrets.GITHUB_TOKEN }}
177186

178187
- name: "Validate Current Org and Workflow"
179188
id: validate-org-workflow
@@ -217,6 +226,7 @@ jobs:
217226
steps.s3-cache.outputs.cache-hit != 'true'
218227
run: |
219228
Rscript /home/rstudio/.workbench/fortify_renv_cache.R
229+
shell: bash
220230

221231
- name: "Validate and Build Markdown"
222232
id: build-site

.github/workflows/update-cache.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ jobs:
5353
echo "ok=false" >> $GITHUB_OUTPUT
5454
echo "Not Running Today"
5555
fi
56+
shell: bash
5657

5758
check-renv:
5859
name: "Check If We Need {renv}"
@@ -123,14 +124,14 @@ jobs:
123124
- name: "Set PAT from AWS Secrets Manager"
124125
if: steps.validate-org-workflow.outputs.is_valid == 'true'
125126
id: set-pat
126-
shell: bash
127127
run: |
128128
SECRET=$(aws secretsmanager get-secret-value \
129129
--secret-id carpentries-bot/github-pat \
130130
--query SecretString --output text)
131131
PAT=$(echo "$SECRET" | jq -r .[])
132132
echo "::add-mask::$PAT"
133133
echo "pat=$PAT" >> "$GITHUB_OUTPUT"
134+
shell: bash
134135

135136
- name: "Validate token"
136137
id: validate-token
@@ -141,7 +142,7 @@ jobs:
141142
# Create the PR with the following roles in order of preference:
142143
# - Carpentries Bot classic PAT fetched from AWS (will only work in official Carpentries repos)
143144
# - repo-scoped SANDPAPER_WORKFLOW classic PAT (will work in all scenarios)
144-
# - default GITHUB_TOKEN (will work suitably, but PR preflight checks will not occur)
145+
# - default GITHUB_TOKEN (will work suitably, but workflows need to be triggered)
145146
- name: "Create Pull Request"
146147
id: cpr
147148
if: |
@@ -185,6 +186,7 @@ jobs:
185186
if: steps.update.outputs.n == 0
186187
run: |
187188
echo "No updates needed, skipping PR creation"
189+
shell: bash
188190

189191
- name: "Trigger Apply Cache Workflow"
190192
if: steps.update.outputs.n == 0

.github/workflows/update-workflows.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ jobs:
4343

4444
- name: Set PAT from AWS Secrets Manager
4545
id: set-pat
46-
shell: bash
4746
run: |
4847
SECRET=$(aws secretsmanager get-secret-value \
4948
--secret-id carpentries-bot/github-pat \
5049
--query SecretString --output text)
5150
PAT=$(echo "$SECRET" | jq -r .[])
5251
echo "::add-mask::$PAT"
5352
echo "pat=$PAT" >> "$GITHUB_OUTPUT"
53+
shell: bash
5454

5555
- name: "Validate token"
5656
id: validate-token

0 commit comments

Comments
 (0)