Skip to content

Commit 4801865

Browse files
committed
GitHub disallows secrets in job-level if expressions
1 parent 881a82d commit 4801865

4 files changed

Lines changed: 27 additions & 11 deletions

File tree

.github/workflows/campfire-notify.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ permissions:
99

1010
jobs:
1111
post-commit-info:
12-
if: secrets.CAMPFIRE_MESSAGES_URL != ''
1312
runs-on: ubuntu-latest
1413
steps:
1514
- name: Post commit info to Campfire
15+
if: secrets.CAMPFIRE_MESSAGES_URL != ''
1616
continue-on-error: true
1717
uses: shane-lamb/campfire-notify-action@df63cf73810147306276e281bedccf71c1519caf # v1.1.6
1818
with:

.github/workflows/docker-containers.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,24 @@ permissions:
3131
env:
3232
DOCKER_PUSH: true
3333
jobs:
34+
docker-configured:
35+
runs-on: ubuntu-latest
36+
outputs:
37+
enabled: ${{ steps.check.outputs.enabled }}
38+
steps:
39+
- id: check
40+
env:
41+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
42+
run: |
43+
if [ -n "${DOCKER_USERNAME}" ]; then
44+
echo "enabled=true" >> "$GITHUB_OUTPUT"
45+
else
46+
echo "enabled=false" >> "$GITHUB_OUTPUT"
47+
fi
48+
3449
pwpush-container:
35-
if: secrets.DOCKER_USERNAME != '' && ((github.event.label && github.event.label.name == 'docker') || github.event_name != 'pull_request')
50+
needs: docker-configured
51+
if: needs.docker-configured.outputs.enabled == 'true' && ((github.event.label && github.event.label.name == 'docker') || github.event_name != 'pull_request')
3652
runs-on: ubuntu-latest
3753
steps:
3854
- name: Checkout
@@ -83,7 +99,7 @@ jobs:
8399
type=gha,mode=max
84100
85101
- name: Post job failure details to Campfire
86-
if: failure() && github.ref == 'refs/heads/master'
102+
if: failure() && secrets.CAMPFIRE_MESSAGES_URL != '' && github.ref == 'refs/heads/master'
87103
continue-on-error: true
88104
uses: shane-lamb/campfire-notify-action@df63cf73810147306276e281bedccf71c1519caf # v1.1.6
89105
with:
@@ -92,8 +108,8 @@ jobs:
92108

93109

94110
public-gateway-container:
95-
if: secrets.DOCKER_USERNAME != '' && ((github.event.label && github.event.label.name == 'docker') || github.event_name != 'pull_request')
96-
needs: pwpush-container
111+
needs: [docker-configured, pwpush-container]
112+
if: needs.docker-configured.outputs.enabled == 'true' && ((github.event.label && github.event.label.name == 'docker') || github.event_name != 'pull_request')
97113
runs-on: ubuntu-latest
98114
steps:
99115
- name: Checkout
@@ -149,16 +165,16 @@ jobs:
149165
type=gha,mode=max
150166
151167
- name: Post job failure details to Campfire
152-
if: failure() && github.ref == 'refs/heads/master'
168+
if: failure() && secrets.CAMPFIRE_MESSAGES_URL != '' && github.ref == 'refs/heads/master'
153169
continue-on-error: true
154170
uses: shane-lamb/campfire-notify-action@df63cf73810147306276e281bedccf71c1519caf # v1.1.6
155171
with:
156172
messages_url: ${{ secrets.CAMPFIRE_MESSAGES_URL }}
157173
template: job_failed
158174

159175
worker-container:
160-
if: secrets.DOCKER_USERNAME != '' && ((github.event.label && github.event.label.name == 'docker') || github.event_name != 'pull_request')
161-
needs: pwpush-container
176+
needs: [docker-configured, pwpush-container]
177+
if: needs.docker-configured.outputs.enabled == 'true' && ((github.event.label && github.event.label.name == 'docker') || github.event_name != 'pull_request')
162178
runs-on: ubuntu-latest
163179
steps:
164180
- name: Checkout
@@ -214,7 +230,7 @@ jobs:
214230
type=gha,mode=max
215231
216232
- name: Post job failure details to Campfire
217-
if: failure() && github.ref == 'refs/heads/master'
233+
if: failure() && secrets.CAMPFIRE_MESSAGES_URL != '' && github.ref == 'refs/heads/master'
218234
continue-on-error: true
219235
uses: shane-lamb/campfire-notify-action@df63cf73810147306276e281bedccf71c1519caf # v1.1.6
220236
with:

.github/workflows/hatchbox-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ permissions:
1313

1414
jobs:
1515
deploy:
16-
if: secrets.HATCHBOX_DEPLOY_KEY != ''
1716
runs-on: ubuntu-latest
1817
steps:
1918
- name: Deploy to Hatchbox
19+
if: secrets.HATCHBOX_DEPLOY_KEY != ''
2020
uses: hatchboxio/github-hatchbox-deploy-action@3bbadafe51e89bbf29fd3932bd84534f4fc9a00c # v2
2121
with:
2222
deploy_key: ${{ secrets.HATCHBOX_DEPLOY_KEY }}

.github/workflows/lint-helm.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
run: ct install --config ./ct.yaml --target-branch "$TARGET_BRANCH"
5353

5454
- name: Post job failure details to Campfire
55-
if: failure() && github.base_ref == env.TARGET_BRANCH
55+
if: failure() && secrets.CAMPFIRE_MESSAGES_URL != '' && github.base_ref == env.TARGET_BRANCH
5656
continue-on-error: true
5757
uses: shane-lamb/campfire-notify-action@df63cf73810147306276e281bedccf71c1519caf # v1.1.6
5858
with:

0 commit comments

Comments
 (0)