From fc4e79024e7f8a303f53a4ac428a3236c70231ba Mon Sep 17 00:00:00 2001 From: John Wesley Walker III <81404201+jww3@users.noreply.github.com> Date: Thu, 22 Feb 2024 13:55:07 +0100 Subject: [PATCH 1/2] Warn on attempts to publish test-ubuntu-git from non-main branch. --- .github/workflows/update-test-ubuntu-git.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/update-test-ubuntu-git.yml b/.github/workflows/update-test-ubuntu-git.yml index 848124342..541ce0dbc 100644 --- a/.github/workflows/update-test-ubuntu-git.yml +++ b/.github/workflows/update-test-ubuntu-git.yml @@ -42,6 +42,10 @@ jobs: # Use `date` with a custom format to achieve the key=value format GITHUB_OUTPUT expects. run: date -u "+now=%Y%m%d.%H%M%S.%3NZ" >> "$GITHUB_OUTPUT" + - name: Issue Image Publish Warning + if: ${{ inputs.publish && github.ref_name != 'main' }} + run: echo "::warning::test-ubuntu-git images can only be published from the actions/checkout 'main' branch. Workflow will continue with push/publish disabled." + # Use `docker/build-push-action` to build (and optionally publish) the image. - name: Build and push Docker image uses: docker/build-push-action@v5.1.0 From 7dacc426ede7062b0aa4a0725e978d86e94a8cb0 Mon Sep 17 00:00:00 2001 From: John Wesley Walker III <81404201+jww3@users.noreply.github.com> Date: Thu, 22 Feb 2024 13:58:55 +0100 Subject: [PATCH 2/2] Rename build step to clarify that Push is optional. --- .github/workflows/update-test-ubuntu-git.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/update-test-ubuntu-git.yml b/.github/workflows/update-test-ubuntu-git.yml index 541ce0dbc..e2d57f316 100644 --- a/.github/workflows/update-test-ubuntu-git.yml +++ b/.github/workflows/update-test-ubuntu-git.yml @@ -47,7 +47,7 @@ jobs: run: echo "::warning::test-ubuntu-git images can only be published from the actions/checkout 'main' branch. Workflow will continue with push/publish disabled." # Use `docker/build-push-action` to build (and optionally publish) the image. - - name: Build and push Docker image + - name: Build Docker Image (with optional Push) uses: docker/build-push-action@v5.1.0 with: context: .