Skip to content

Commit 5eb6a3b

Browse files
authored
fix(deploy): improve URL extraction logic in deployment script (#508)
1 parent f442c14 commit 5eb6a3b

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

.github/workflows/deploy.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,19 @@ jobs:
224224
else
225225
bun run deploy --preview | tee deploy_output.log
226226
fi
227-
URL=$(grep -oP 'App URL: \Khttps://[^\s]+' deploy_output.log || echo "https://${WORKER_NAME}.${{ secrets.CLOUDFLARE_ACCOUNT_ID }}.workers.dev")
227+
URL="$(grep -oP 'App URL:\s*\Khttps://[^\s]+' deploy_output.log | tail -n 1 || true)"
228+
if [[ -z "$URL" ]]; then
229+
URL="$(awk '
230+
/^Deployed .* triggers/ { in_targets = 1; next }
231+
in_targets && match($0, /https?:\/\/[^[:space:]]+/) { print substr($0, RSTART, RLENGTH); exit }
232+
' deploy_output.log)"
233+
fi
234+
if [[ -z "$URL" ]]; then
235+
echo "❌ Unable to determine deployment URL from deploy output."
236+
grep -E 'App URL:|Deployed .* triggers|https?://' deploy_output.log || true
237+
exit 1
238+
fi
239+
echo "Resolved deployment URL: ${URL}"
228240
echo "url=${URL}" >> $GITHUB_OUTPUT
229241
230242
- name: Comment on PR

0 commit comments

Comments
 (0)