build(deps-dev): bump @cloudflare/workers-types from 4.20260523.1 to 4.20260524.1 in the minor-and-patch group across 1 directory #609
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Cloudflare Workers Preview | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| workflow_dispatch: | |
| concurrency: | |
| group: cloudflare-preview-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| deploy-preview: | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'doocs/md' && github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository | |
| permissions: | |
| contents: read | |
| deployments: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Set up node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v6 | |
| with: | |
| version: 11 | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build for Cloudflare Workers | |
| run: pnpm web build:h5-netlify | |
| env: | |
| CF_WORKERS: 1 | |
| - name: Deploy to Cloudflare Workers | |
| id: deploy | |
| uses: cloudflare/wrangler-action@v4 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| command: deploy --name md-pr-${{ github.event.pull_request.number }} | |
| workingDirectory: apps/web | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| - name: Get deployment URL | |
| id: deployment-url | |
| run: | | |
| PREVIEW_URL="https://md-pr-${{ github.event.pull_request.number }}.doocs.workers.dev" | |
| echo "url=$PREVIEW_URL" >> $GITHUB_OUTPUT | |
| echo "Preview URL: $PREVIEW_URL" | |
| - name: Comment PR with preview link | |
| uses: actions/github-script@v9 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const prNumber = ${{ github.event.pull_request.number }}; | |
| const deployUrl = '${{ steps.deployment-url.outputs.url }}'; | |
| const commitSha = '${{ github.event.pull_request.head.sha }}'; | |
| const body = [ | |
| '🚀 Cloudflare Workers Preview has been successfully deployed!', | |
| '', | |
| `**Preview URL:** ${deployUrl}`, | |
| '', | |
| `<sub>Built with commit ${commitSha}</sub>`, | |
| '', | |
| '<!-- Cloudflare Preview Comment -->', | |
| ].join('\n'); | |
| // Upsert: find existing comment and update, or create new | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| }); | |
| const existing = comments.find(c => c.body.includes('<!-- Cloudflare Preview Comment -->')); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existing.id, | |
| body, | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: prNumber, | |
| body, | |
| }); | |
| } |