diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a683f96cede..a8042a3162e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -86,30 +86,31 @@ jobs: with: apiToken: ${{ secrets.CLOUDFLARE_PAGES_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - command: pages deploy dist --project-name=elecord-web - - name: print deployment-url - run: echo ${{ steps.cf.outputs.deployment-url }} - - - run: echo ${{ github.event_name }} - - run: echo ${{ github.event.pull_request.head.sha }} - - run: echo ${{ github.sha }} - - run: echo ${{ github.ref_name }} - - run: echo ${{ github.event.pull_request.number }} - - - name: test logic - if: ${{ github.event_name == 'pull_request_target' && success() }} - run: echo "pass" - - - name: test logic - if: ${{ github.event_name == 'pull_request_target' && failure() }} - run: echo "fail" + command: pages deploy dist --project-name=elecord-web --branch=main # Update PR status comment with deployment URL + - name: Update status comment (Failure) + if: ${{ github.event_name == 'pull_request' && failure() }} + uses: thollander/actions-comment-pull-request@v3 + with: + github-token: ${{ secrets.PR_COMMENTS }} + message: | + ## Cloudflare Pages deployment + + | **Latest commit** | ${{ github.event.pull_request.head.sha || github.sha }} | + |-------------------|:-:| + | **Status** | ❌ Failure. Check workflow logs for details | + | **Preview URL** | Not available | + | **Type** | 🔀 Preview | + pr-number: ${{ github.event.pull_request.number }} + comment-tag: CFPages-deployment + mode: recreate + - name: Update status comment (Success) - if: ${{ github.event_name == 'pull_request_target' && success() }} + if: ${{ github.event_name == 'pull_request' && success() }} uses: thollander/actions-comment-pull-request@v3 with: - GITHUB_TOKEN: ${{ secrets.PR_COMMENTS }} + github-token: ${{ secrets.PR_COMMENTS }} message: | ## Cloudflare Pages deployment @@ -118,23 +119,6 @@ jobs: | **Status** | ✅ Deployed! | | **Preview URL** | ${{ steps.cf.outputs.deployment-url != '' && steps.cf.outputs.deployment-url || 'Not available' }} | | **Type** | 🔀 Preview | - pr_number: ${{ github.event.pull_request.number }} - comment_tag: CFPages-deployment - mode: recreate - - - name: Update status comment (Failure) - if: ${{ github.event_name == 'pull_request_target' && failure() }} - uses: thollander/actions-comment-pull-request@v3 - with: - GITHUB_TOKEN: ${{ secrets.PR_COMMENTS }} - message: | - ## Cloudflare Pages deployment - - | **Latest commit** | ${{ github.event.pull_request.head.sha || github.sha }} | - |-------------------|:-:| - | **Status** | ❌ Failure. Check workflow logs for details | - | **Preview URL** | Not available | - | **Type** | 🔀 Preview | - pr_number: ${{ github.event.pull_request.number }} - comment_tag: CFPages-deployment + pr-number: ${{ github.event.pull_request.number }} + comment-tag: CFPages-deployment mode: recreate \ No newline at end of file