Skip to content

Commit

Permalink
chore(ci): add comment PR workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Sec-ant committed Dec 26, 2023
1 parent 2dc188a commit d8dd463
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Commment PR

on:
repository_dispatch:
types: [build-start, build-finish, build-fail]

permissions:
pull-requests: write
contents: write

jobs:
comment:
runs-on: ubuntu-latest
steps:
- name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.client_payload.pr-number }}
comment-author: "github-actions[bot]"
body-includes: "## ci-bot\n\n"
- name: Comment build start message
if: ${{ github.event.action == 'build-start' }}
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.client_payload.pr-number }}
body: |
## ci-bot
Now I'm building the new package reflecting the changes of this PR. Please be patient.
comment-id: ${{ steps.fc.outputs.comment-id }}
- name: Comment build finish message
if: ${{ github.event.action == 'build-finish' }}
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.client_payload.pr-number }}
body: |
## ci-bot
CI build finished. Use the link below to test the packge:
```
${{ github.event.client_payload.release-url }}
```
For example, in `npm`:
```bash
npm i ${{ github.event.client_payload.release-url }}
```
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
- name: Comment build fail message
if: ${{ github.event.action == 'build-fail' }}
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.client_payload.pr-number }}
body: |
## ci-bot
CI Build failed.
comment-id: ${{ steps.fc.outputs.comment-id }}

0 comments on commit d8dd463

Please sign in to comment.