From f88ee513d4bcd780deb505d72b7b95ac65f20c5a Mon Sep 17 00:00:00 2001 From: Jamie Brunton Date: Sat, 24 Jan 2026 21:45:01 +0000 Subject: [PATCH] Fix function list parsing to skip header rows Use grep to only match lines starting with lowercase (function names), and add validation to skip empty or invalid names. Co-Authored-By: Claude Opus 4.5 --- .github/workflows/deploy-supabase.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-supabase.yml b/.github/workflows/deploy-supabase.yml index 1cb321a..0250d11 100644 --- a/.github/workflows/deploy-supabase.yml +++ b/.github/workflows/deploy-supabase.yml @@ -81,14 +81,18 @@ jobs: - name: Remove Deleted Functions run: | - # Get list of functions deployed on Supabase - deployed=$(supabase functions list --project-ref $SUPABASE_PROJECT_REF | tail -n +2 | awk '{print $1}') + # Get list of functions deployed on Supabase (skip header lines, extract slug column) + deployed=$(supabase functions list --project-ref $SUPABASE_PROJECT_REF | grep -E '^[a-z]' | awk '{print $1}') # Get list of functions in the repo (excluding _shared) local_functions=$(ls -d apps/supabase/functions/*/ 2>/dev/null | xargs -I {} basename {} | grep -v '^_shared$' || true) # Delete any deployed functions that no longer exist in the repo for func in $deployed; do + # Skip empty or invalid function names + [ -z "$func" ] && continue + [[ "$func" =~ ^[^a-z] ]] && continue + if ! echo "$local_functions" | grep -q "^${func}$"; then echo "Deleting removed function: $func" supabase functions delete "$func" --project-ref $SUPABASE_PROJECT_REF