Skip to content

An open-source, faster Devin alternative

TypeScript

avoid api edge route mutation in ci deploy

Igor Zalutski594ee6706eb8
diff --git a/.github/workflows/deploy-api-edge.yml b/.github/workflows/deploy-api-edge.yml
index b80c95b1..7859cb75 100644
--- a/.github/workflows/deploy-api-edge.yml
+++ b/.github/workflows/deploy-api-edge.yml
@@ -85,6 +85,31 @@ jobs:
npm test -- --run
npx tsc --noEmit
+ - name: Prepare CI deploy config
+ working-directory: cloudflare-workers/api-edge
+ run: |
+ python3 - <<'PY'
+ from pathlib import Path
+
+ src = Path("${{ steps.target.outputs.config }}")
+ dst = Path("wrangler.ci.toml")
+ lines = src.read_text().splitlines()
+
+ out = []
+ skipping_routes = False
+ for line in lines:
+ if line.startswith("routes = ["):
+ skipping_routes = True
+ continue
+ if skipping_routes:
+ if line.strip() == "]":
+ skipping_routes = False
+ continue
+ out.append(line)
+
+ dst.write_text("\n".join(out).rstrip() + "\n")
+ PY
+
- name: Deploy ${{ steps.target.outputs.name }}
working-directory: cloudflare-workers/api-edge
env:
@@ -94,4 +119,4 @@ jobs:
echo "CLOUDFLARE_API_TOKEN GitHub secret is required for Wrangler deploys" >&2
exit 1
fi
- npx wrangler deploy -c "${{ steps.target.outputs.config }}"
+ npx wrangler deploy -c wrangler.ci.toml