From 2a708eb007679a9d33bbdb0640c47b3176677e6f Mon Sep 17 00:00:00 2001 From: Matt Date: Sat, 30 Dec 2023 12:47:27 -0600 Subject: [PATCH] Refactor UUID mapping in deploy.yml --- .github/workflows/deploy.yml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5f43d33c..3da2760e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -14,15 +14,17 @@ jobs: run: | notify_coolify() { local env_name=$1 - local uuid_map=$2 + local -n uuid_map=$2 # Use nameref for associative array # Map package name to UUID - case "${{ github.event.registry_package.name }}" in - "dota") UUID=${uuid_map["dota"]} ;; - "twitch-events") UUID=${uuid_map["twitch-events"]} ;; - "twitch-chat") UUID=${uuid_map["twitch-chat"]} ;; - "steam") UUID=${uuid_map["steam"]} ;; - esac + local package_name="${{ github.event.registry_package.name }}" + local UUID=${uuid_map[$package_name]} + + # Check if UUID is empty + if [ -z "$UUID" ]; then + echo "UUID not found for package $package_name" + return 1 + fi # Notify Coolify echo "Notifying Coolify for $env_name environment: $UUID"