From ad48090ff77fafa60536cd1f70cf558e90487ec8 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 16 May 2026 16:58:44 +0000 Subject: [PATCH] Fly deploy: jq-based app existence check The grep-against-JSON existence check missed an existing app because fly's JSON output has whitespace between key/colon/value ("Name": "cotrackpro-talk") and the grep pattern looked for the no-space form. The step then tried to create the app and Fly correctly rejected with "Name has already been taken." Switch to a jq predicate that parses the JSON and tolerates both the array-of-apps and object-keyed-by-app shapes. --- .github/workflows/fly-deploy.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/fly-deploy.yml b/.github/workflows/fly-deploy.yml index 29a31a8..3f863c3 100644 --- a/.github/workflows/fly-deploy.yml +++ b/.github/workflows/fly-deploy.yml @@ -132,7 +132,15 @@ jobs: # https://github.com///settings/variables/actions FLY_ORG_OVERRIDE: ${{ vars.FLY_ORG }} run: | - if fly apps list -j | grep -q "\"Name\":\"$FLY_APP_NAME\""; then + # Use jq for the existence check — grep against fly's + # JSON output was fragile (formatting whitespace caused + # it to miss an app that actually existed). + exists=$(fly apps list -j | jq -r --arg n "$FLY_APP_NAME" ' + if type == "array" then any(.[]; (.Name // .name) == $n) + else has($n) + end + ') + if [ "$exists" = "true" ]; then echo "app $FLY_APP_NAME exists" exit 0 fi