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 <noreply@anthropic.com>
This commit is contained in:
jjbruntonandClaude Opus 4.5 committed 2026-01-24 21:45:01 +00:00
1 parent 5ae776d921
commit f88ee513d4
1 file changed
+6 -2
+6 -2
View File
@@ -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