Skip to content

Commit

Permalink
chore(github): fix pr comment
Browse files Browse the repository at this point in the history
  • Loading branch information
hazzuk committed Dec 8, 2024
1 parent df08f19 commit efc8fe4
Showing 1 changed file with 22 additions and 38 deletions.
60 changes: 22 additions & 38 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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** | <code>${{ github.event.pull_request.head.sha || github.sha }}</code> |
|-------------------|:-:|
| **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
Expand All @@ -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** | <code>${{ github.event.pull_request.head.sha || github.sha }}</code> |
|-------------------|:-:|
| **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

0 comments on commit efc8fe4

Please sign in to comment.