Skip to content

Commit 05932a2

Browse files
committed
GitHub disallows secrets in job-level if expressions
1 parent dc5ac99 commit 05932a2

4 files changed

Lines changed: 66 additions & 6 deletions

File tree

.github/workflows/campfire-notify.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,18 @@ jobs:
1111
post-commit-info:
1212
runs-on: ubuntu-latest
1313
steps:
14+
- id: campfire-configured
15+
env:
16+
CAMPFIRE_MESSAGES_URL: ${{ secrets.CAMPFIRE_MESSAGES_URL }}
17+
run: |
18+
if [ -n "${CAMPFIRE_MESSAGES_URL}" ]; then
19+
echo "configured=true" >> "$GITHUB_OUTPUT"
20+
else
21+
echo "configured=false" >> "$GITHUB_OUTPUT"
22+
fi
23+
1424
- name: Post commit info to Campfire
15-
if: secrets.CAMPFIRE_MESSAGES_URL != ''
25+
if: steps.campfire-configured.outputs.configured == 'true'
1626
continue-on-error: true
1727
uses: shane-lamb/campfire-notify-action@df63cf73810147306276e281bedccf71c1519caf # v1.1.6
1828
with:

.github/workflows/docker-containers.yml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ jobs:
4747
if: needs.docker-configured.outputs.enabled == 'true' && ((github.event.label && github.event.label.name == 'docker') || github.event_name != 'pull_request')
4848
runs-on: ubuntu-latest
4949
steps:
50+
- id: campfire-configured
51+
env:
52+
CAMPFIRE_MESSAGES_URL: ${{ secrets.CAMPFIRE_MESSAGES_URL }}
53+
run: |
54+
if [ -n "${CAMPFIRE_MESSAGES_URL}" ]; then
55+
echo "configured=true" >> "$GITHUB_OUTPUT"
56+
else
57+
echo "configured=false" >> "$GITHUB_OUTPUT"
58+
fi
59+
5060
- name: Checkout
5161
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
5262
with:
@@ -95,7 +105,7 @@ jobs:
95105
type=gha,mode=max
96106
97107
- name: Post job failure details to Campfire
98-
if: failure() && secrets.CAMPFIRE_MESSAGES_URL != '' && github.ref == 'refs/heads/master'
108+
if: failure() && steps.campfire-configured.outputs.configured == 'true' && github.ref == 'refs/heads/master'
99109
continue-on-error: true
100110
uses: shane-lamb/campfire-notify-action@df63cf73810147306276e281bedccf71c1519caf # v1.1.6
101111
with:
@@ -108,6 +118,16 @@ jobs:
108118
if: needs.docker-configured.outputs.enabled == 'true' && ((github.event.label && github.event.label.name == 'docker') || github.event_name != 'pull_request')
109119
runs-on: ubuntu-latest
110120
steps:
121+
- id: campfire-configured
122+
env:
123+
CAMPFIRE_MESSAGES_URL: ${{ secrets.CAMPFIRE_MESSAGES_URL }}
124+
run: |
125+
if [ -n "${CAMPFIRE_MESSAGES_URL}" ]; then
126+
echo "configured=true" >> "$GITHUB_OUTPUT"
127+
else
128+
echo "configured=false" >> "$GITHUB_OUTPUT"
129+
fi
130+
111131
- name: Checkout
112132
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
113133
with:
@@ -161,7 +181,7 @@ jobs:
161181
type=gha,mode=max
162182
163183
- name: Post job failure details to Campfire
164-
if: failure() && secrets.CAMPFIRE_MESSAGES_URL != '' && github.ref == 'refs/heads/master'
184+
if: failure() && steps.campfire-configured.outputs.configured == 'true' && github.ref == 'refs/heads/master'
165185
continue-on-error: true
166186
uses: shane-lamb/campfire-notify-action@df63cf73810147306276e281bedccf71c1519caf # v1.1.6
167187
with:
@@ -173,6 +193,16 @@ jobs:
173193
if: needs.docker-configured.outputs.enabled == 'true' && ((github.event.label && github.event.label.name == 'docker') || github.event_name != 'pull_request')
174194
runs-on: ubuntu-latest
175195
steps:
196+
- id: campfire-configured
197+
env:
198+
CAMPFIRE_MESSAGES_URL: ${{ secrets.CAMPFIRE_MESSAGES_URL }}
199+
run: |
200+
if [ -n "${CAMPFIRE_MESSAGES_URL}" ]; then
201+
echo "configured=true" >> "$GITHUB_OUTPUT"
202+
else
203+
echo "configured=false" >> "$GITHUB_OUTPUT"
204+
fi
205+
176206
- name: Checkout
177207
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
178208
with:
@@ -226,7 +256,7 @@ jobs:
226256
type=gha,mode=max
227257
228258
- name: Post job failure details to Campfire
229-
if: failure() && secrets.CAMPFIRE_MESSAGES_URL != '' && github.ref == 'refs/heads/master'
259+
if: failure() && steps.campfire-configured.outputs.configured == 'true' && github.ref == 'refs/heads/master'
230260
continue-on-error: true
231261
uses: shane-lamb/campfire-notify-action@df63cf73810147306276e281bedccf71c1519caf # v1.1.6
232262
with:

.github/workflows/hatchbox-deploy.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,18 @@ jobs:
1212
deploy:
1313
runs-on: ubuntu-latest
1414
steps:
15+
- id: hatchbox-configured
16+
env:
17+
HATCHBOX_DEPLOY_KEY: ${{ secrets.HATCHBOX_DEPLOY_KEY }}
18+
run: |
19+
if [ -n "${HATCHBOX_DEPLOY_KEY}" ]; then
20+
echo "configured=true" >> "$GITHUB_OUTPUT"
21+
else
22+
echo "configured=false" >> "$GITHUB_OUTPUT"
23+
fi
24+
1525
- name: Deploy to Hatchbox
16-
if: secrets.HATCHBOX_DEPLOY_KEY != ''
26+
if: steps.hatchbox-configured.outputs.configured == 'true'
1727
uses: hatchboxio/github-hatchbox-deploy-action@3bbadafe51e89bbf29fd3932bd84534f4fc9a00c # v2
1828
with:
1929
deploy_key: ${{ secrets.HATCHBOX_DEPLOY_KEY }}

.github/workflows/lint-helm.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ jobs:
1111
env:
1212
TARGET_BRANCH: ${{ github.event.repository.default_branch }}
1313
steps:
14+
- id: campfire-configured
15+
env:
16+
CAMPFIRE_MESSAGES_URL: ${{ secrets.CAMPFIRE_MESSAGES_URL }}
17+
run: |
18+
if [ -n "${CAMPFIRE_MESSAGES_URL}" ]; then
19+
echo "configured=true" >> "$GITHUB_OUTPUT"
20+
else
21+
echo "configured=false" >> "$GITHUB_OUTPUT"
22+
fi
23+
1424
- name: Checkout
1525
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
1626
with:
@@ -51,7 +61,7 @@ jobs:
5161
run: ct install --config ./ct.yaml --target-branch "$TARGET_BRANCH"
5262

5363
- name: Post job failure details to Campfire
54-
if: failure() && secrets.CAMPFIRE_MESSAGES_URL != '' && github.base_ref == env.TARGET_BRANCH
64+
if: failure() && steps.campfire-configured.outputs.configured == 'true' && github.base_ref == env.TARGET_BRANCH
5565
continue-on-error: true
5666
uses: shane-lamb/campfire-notify-action@df63cf73810147306276e281bedccf71c1519caf # v1.1.6
5767
with:

0 commit comments

Comments
 (0)