diff --git a/.github/workflows/preview-deploy.yml b/.github/workflows/preview-deploy.yml index 6a5a29dff6..3af230dbdf 100644 --- a/.github/workflows/preview-deploy.yml +++ b/.github/workflows/preview-deploy.yml @@ -46,6 +46,8 @@ jobs: [http_service] internal_port = 8210 force_https = true + auto_stop_machines = "stop" + min_machines_running = 0 [[vm]] size = "shared-cpu-1x" @@ -83,6 +85,10 @@ jobs: - name: Destroy Fly app run: | - flyctl apps destroy "${{ env.FLY_APP }}" --yes 2>/dev/null || true + if flyctl apps list --json | jq -e --arg name "${{ env.FLY_APP }}" '.[] | select(.Name == $name)' > /dev/null; then + flyctl apps destroy "${{ env.FLY_APP }}" --yes + else + echo "App ${{ env.FLY_APP }} does not exist, nothing to destroy" + fi env: FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}