From 8e59b6d3b31773c7359cc41e47ec2fec0cac1203 Mon Sep 17 00:00:00 2001
From: Josh Soref <2119212+jsoref@users.noreply.github.com>
Date: Fri, 31 May 2024 11:44:57 -0400
Subject: [PATCH] Look for secrets before using them (#2918)

Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
---
 .github/workflows/artifacts.yaml | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/artifacts.yaml b/.github/workflows/artifacts.yaml
index 1c047ea4..f90aa0ac 100644
--- a/.github/workflows/artifacts.yaml
+++ b/.github/workflows/artifacts.yaml
@@ -28,10 +28,26 @@ permissions:
   contents: read
 
 jobs:
-  container-image:
-    name: Container image
+  config:
     runs-on: ubuntu-latest
+    steps:
+      - name: Check Secrets
+        id: check-secrets
+        env:
+          username: ${{ secrets.DOCKER_USERNAME || '' }}
+          password: ${{ secrets.DOCKER_PASSWORD || '' }}
+        if: ${{ env.username != '' && env.password  != '' }}
+        shell: bash
+        run:
+          echo has-secrets=1 >> "$GITHUB_OUTPUT"
+    outputs:
+      has-secrets: ${{ steps.check-secrets.outputs.has-secrets }}
 
+  container-images:
+    name: Container images
+    runs-on: ubuntu-latest
+    needs: config
+    if: ${{ needs.config.outputs.has-secrets }}
     strategy:
       matrix:
         variant:
-- 
GitLab