|
1 | | ---- |
2 | | -# Fork PR builds run only when a maintainer adds the "docker" label. Login and push |
3 | | -# are disabled for fork PRs; labeled fork PRs still execute untrusted Dockerfiles. |
4 | | -# Skipped entirely when DOCKER_USERNAME is not configured (e.g. forks). |
5 | 1 | name: Docker Container Builds |
6 | 2 |
|
7 | 3 | on: |
@@ -31,8 +27,24 @@ permissions: |
31 | 27 | env: |
32 | 28 | DOCKER_PUSH: true |
33 | 29 | jobs: |
| 30 | + docker-configured: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + outputs: |
| 33 | + enabled: ${{ steps.check.outputs.enabled }} |
| 34 | + steps: |
| 35 | + - id: check |
| 36 | + env: |
| 37 | + DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} |
| 38 | + run: | |
| 39 | + if [ -n "${DOCKER_USERNAME}" ]; then |
| 40 | + echo "enabled=true" >> "$GITHUB_OUTPUT" |
| 41 | + else |
| 42 | + echo "enabled=false" >> "$GITHUB_OUTPUT" |
| 43 | + fi |
| 44 | +
|
34 | 45 | pwpush-container: |
35 | | - if: secrets.DOCKER_USERNAME != '' && ((github.event.label && github.event.label.name == 'docker') || github.event_name != 'pull_request') |
| 46 | + needs: docker-configured |
| 47 | + if: needs.docker-configured.outputs.enabled == 'true' && ((github.event.label && github.event.label.name == 'docker') || github.event_name != 'pull_request') |
36 | 48 | runs-on: ubuntu-latest |
37 | 49 | steps: |
38 | 50 | - name: Checkout |
|
83 | 95 | type=gha,mode=max |
84 | 96 |
|
85 | 97 | - name: Post job failure details to Campfire |
86 | | - if: failure() && github.ref == 'refs/heads/master' |
| 98 | + if: failure() && secrets.CAMPFIRE_MESSAGES_URL != '' && github.ref == 'refs/heads/master' |
87 | 99 | continue-on-error: true |
88 | 100 | uses: shane-lamb/campfire-notify-action@df63cf73810147306276e281bedccf71c1519caf # v1.1.6 |
89 | 101 | with: |
|
92 | 104 |
|
93 | 105 |
|
94 | 106 | 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 |
| 107 | + needs: [docker-configured, pwpush-container] |
| 108 | + if: needs.docker-configured.outputs.enabled == 'true' && ((github.event.label && github.event.label.name == 'docker') || github.event_name != 'pull_request') |
97 | 109 | runs-on: ubuntu-latest |
98 | 110 | steps: |
99 | 111 | - name: Checkout |
@@ -149,16 +161,16 @@ jobs: |
149 | 161 | type=gha,mode=max |
150 | 162 |
|
151 | 163 | - name: Post job failure details to Campfire |
152 | | - if: failure() && github.ref == 'refs/heads/master' |
| 164 | + if: failure() && secrets.CAMPFIRE_MESSAGES_URL != '' && github.ref == 'refs/heads/master' |
153 | 165 | continue-on-error: true |
154 | 166 | uses: shane-lamb/campfire-notify-action@df63cf73810147306276e281bedccf71c1519caf # v1.1.6 |
155 | 167 | with: |
156 | 168 | messages_url: ${{ secrets.CAMPFIRE_MESSAGES_URL }} |
157 | 169 | template: job_failed |
158 | 170 |
|
159 | 171 | worker-container: |
160 | | - if: secrets.DOCKER_USERNAME != '' && ((github.event.label && github.event.label.name == 'docker') || github.event_name != 'pull_request') |
161 | | - needs: pwpush-container |
| 172 | + needs: [docker-configured, pwpush-container] |
| 173 | + if: needs.docker-configured.outputs.enabled == 'true' && ((github.event.label && github.event.label.name == 'docker') || github.event_name != 'pull_request') |
162 | 174 | runs-on: ubuntu-latest |
163 | 175 | steps: |
164 | 176 | - name: Checkout |
@@ -214,7 +226,7 @@ jobs: |
214 | 226 | type=gha,mode=max |
215 | 227 |
|
216 | 228 | - name: Post job failure details to Campfire |
217 | | - if: failure() && github.ref == 'refs/heads/master' |
| 229 | + if: failure() && secrets.CAMPFIRE_MESSAGES_URL != '' && github.ref == 'refs/heads/master' |
218 | 230 | continue-on-error: true |
219 | 231 | uses: shane-lamb/campfire-notify-action@df63cf73810147306276e281bedccf71c1519caf # v1.1.6 |
220 | 232 | with: |
|
0 commit comments