Skip to content

Commit 8a5b49b

Browse files
committed
ci(vercel): use VERCEL_AUTOMATION_BYPASS_SECRET in all curl checks (server, web, integration) and set Host/Accept headers
1 parent 6d9c155 commit 8a5b49b

1 file changed

Lines changed: 30 additions & 11 deletions

File tree

.github/workflows/test-deploy.yml

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ jobs:
9191
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_API_ID }}
9292
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} # optional for Personal
9393
VERCEL_TELEMETRY_DISABLED: "1"
94+
VERCEL_AUTOMATION_BYPASS_SECRET: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }}
9495
steps:
9596
- uses: actions/checkout@v4
9697
- uses: actions/setup-node@v4
@@ -118,15 +119,21 @@ jobs:
118119
run: |
119120
echo "Waiting for deployment to be ready..."
120121
DEPLOY_URL="${{ steps.deploy.outputs.deploy_url }}"
121-
echo "Testing health at: $DEPLOY_URL/api/health"
122+
HOST_HEADER=$(echo "$DEPLOY_URL" | awk -F/ '{print $3}')
123+
echo "Testing health at: $DEPLOY_URL/api/health (Host: $HOST_HEADER)"
122124
# Initial wait to allow cold start and DNS propagation
123125
sleep 15
124126
for i in {1..30}; do
125-
if curl -fsS "$DEPLOY_URL/api/health" > /dev/null; then
126-
echo "✅ Server health check passed"
127+
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
128+
-H "Host: $HOST_HEADER" \
129+
-H "Accept: application/json" \
130+
-H "x-vercel-protection-bypass: $VERCEL_AUTOMATION_BYPASS_SECRET" \
131+
"$DEPLOY_URL/api/health")
132+
if [ "$STATUS" = "200" ]; then
133+
echo "✅ Server health check passed (200)"
127134
exit 0
128135
fi
129-
echo "Attempt $i failed; retrying in 5s..."
136+
echo "Attempt $i failed; status=$STATUS; retrying in 5s..."
130137
sleep 5
131138
done
132139
echo "❌ Server health check failed"
@@ -147,6 +154,7 @@ jobs:
147154
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_WEB_ID }}
148155
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} # optional
149156
VERCEL_TELEMETRY_DISABLED: "1"
157+
VERCEL_AUTOMATION_BYPASS_SECRET: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }}
150158
steps:
151159
- uses: actions/checkout@v4
152160
- uses: actions/setup-node@v4
@@ -197,14 +205,19 @@ jobs:
197205
run: |
198206
echo "Waiting for deployment to be ready..."
199207
DEPLOY_URL="${{ steps.deploy-mobile.outputs.deploy_url }}"
200-
echo "Testing mobile app at: $DEPLOY_URL"
208+
HOST_HEADER=$(echo "$DEPLOY_URL" | awk -F/ '{print $3}')
209+
echo "Testing mobile app at: $DEPLOY_URL (Host: $HOST_HEADER)"
201210
sleep 15
202211
for i in {1..30}; do
203-
if curl -fsS "$DEPLOY_URL" > /dev/null; then
204-
echo "✅ Mobile app health check passed"
212+
STATUS=$(curl -s -o /dev/null -w "%{http_code}" \
213+
-H "Host: $HOST_HEADER" \
214+
-H "x-vercel-protection-bypass: $VERCEL_AUTOMATION_BYPASS_SECRET" \
215+
"$DEPLOY_URL")
216+
if [ "$STATUS" = "200" ]; then
217+
echo "✅ Mobile app health check passed (200)"
205218
exit 0
206219
fi
207-
echo "Attempt $i failed; retrying in 5s..."
220+
echo "Attempt $i failed; status=$STATUS; retrying in 5s..."
208221
sleep 5
209222
done
210223
echo "❌ Mobile app health check failed"
@@ -218,6 +231,8 @@ jobs:
218231
runs-on: ubuntu-latest
219232
needs: [deploy-server, deploy-web]
220233
if: github.ref == 'refs/heads/main'
234+
env:
235+
VERCEL_AUTOMATION_BYPASS_SECRET: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }}
221236
steps:
222237
- uses: actions/checkout@v4
223238
- name: Test API endpoints
@@ -227,12 +242,16 @@ jobs:
227242
echo "Testing API at: $API_URL"
228243
229244
# Test health endpoint
230-
curl -f "$API_URL/api/health"
245+
curl -f \
246+
-H "x-vercel-protection-bypass: $VERCEL_AUTOMATION_BYPASS_SECRET" \
247+
-H "Accept: application/json" \
248+
"$API_URL/api/health"
231249
echo "✅ Health endpoint working"
232250
233251
# Test clean endpoint
234252
curl -f -X POST "$API_URL/api/clean" \
235253
-H "Content-Type: application/json" \
254+
-H "x-vercel-protection-bypass: $VERCEL_AUTOMATION_BYPASS_SECRET" \
236255
-d '{"url": "https://example.com?utm_source=test"}'
237256
echo "✅ Clean endpoint working"
238257
@@ -243,11 +262,11 @@ jobs:
243262
echo "Testing mobile app at: $MOBILE_URL"
244263
245264
# Test mobile app loads
246-
curl -f "$MOBILE_URL"
265+
curl -f -H "x-vercel-protection-bypass: $VERCEL_AUTOMATION_BYPASS_SECRET" "$MOBILE_URL"
247266
echo "✅ Mobile app loading"
248267
249268
# Test mobile app assets
250-
curl -f "$MOBILE_URL/manifest.json"
269+
curl -f -H "x-vercel-protection-bypass: $VERCEL_AUTOMATION_BYPASS_SECRET" "$MOBILE_URL/manifest.json"
251270
echo "✅ Mobile app assets working"
252271
253272
- name: Deployment summary

0 commit comments

Comments
 (0)