File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -31,15 +31,25 @@ jobs:
3131 name : Build
3232 env :
3333 NODE_OPTIONS : --max-old-space-size=4096
34- - run : npx wrangler pages deploy --project-name cloudflare-docs dist
35- name : Deploy to Cloudflare Pages
36- env :
37- CLOUDFLARE_ACCOUNT_ID : ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
38- CLOUDFLARE_API_TOKEN : ${{ secrets.CLOUDFLARE_API_TOKEN }}
3934 - run : npx wrangler versions upload -c ./wrangler-workers.toml
4035 name : Deploy to Cloudflare Workers
4136 env :
4237 CLOUDFLARE_API_TOKEN : ${{ secrets.CLOUDFLARE_API_TOKEN }}
38+ WRANGLER_OUTPUT_FILE_PATH : wrangler-logs.json
39+ - name : Post preview URL on PR
40+ env :
41+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
42+ run : |
43+ PR=$(gh pr list --head ${{ github.ref_name }} --limit 1 --json number --jq '.[].number')
44+
45+ if [ -z "$PR" ]; then
46+ URL=$(cat wrangler-logs.json | jq 'select(.type=="version-upload") | .preview_url')
47+
48+ if [ -z "$URL" ]; then
49+ BODY="**Preview URL:** $URL"
50+ gh pr comment "$PR" --repo ${{ github.repository }} --edit-last --body-file -
51+ fi
52+ fi
4353 - uses : actions/cache/save@v4
4454 if : always()
4555 with :
You can’t perform that action at this time.
0 commit comments