Skip to content

Commit 3746f05

Browse files
committed
chore(ci): pr comment
1 parent cd88d16 commit 3746f05

File tree

2 files changed

+28
-5
lines changed

2 files changed

+28
-5
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ jobs:
3838
node-version: "latest"
3939
cache: "npm"
4040
- name: Get commit ID
41-
id: "commit_id"
42-
run: echo "COMMIT_ID=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
41+
id: "commit-id"
42+
run: echo "id=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
4343
- name: Patch package.json
4444
run: npm pkg set version=$(git rev-parse --short HEAD)
4545
- name: Install dependencies
@@ -52,12 +52,15 @@ jobs:
5252
id: "release"
5353
uses: ncipollo/release-action@v1
5454
with:
55-
artifacts: "zxing-wasm-${{ steps.commit_id.outputs.commit_id }}.tgz"
55+
artifacts: "zxing-wasm-${{ steps.commit-id.outputs.id }}.tgz"
5656
commit: ${{ github.head_ref || github.ref_name }}
57-
tag: ${{ steps.commit_id.outputs.commit_id }}
57+
tag: ${{ steps.commit-id.outputs.id }}
5858
allowUpdates: true
59+
- name: Get PR Number
60+
id: get-pr-number
61+
uses: mgaitan/gha-get-pr-number
5962
- name: Build Finish Dispatch
6063
uses: peter-evans/repository-dispatch@v2
6164
with:
6265
event-type: build-finish
63-
client-payload: '{ "release-url": "${{steps.release.outputs.html_url}}" }'
66+
client-payload: '{ "release-url": "${{steps.release.outputs.html_url}}/zxing-wasm-${{ steps.commit-id.outputs.id }}.tgz", "pr-number": ${{ steps.get-pr-number.outputs.number }} }'

.github/workflows/comment.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Commment PR
2+
3+
on:
4+
repository_dispatch:
5+
types: [build-finish]
6+
7+
permissions:
8+
pull-requests: write
9+
contents: write
10+
11+
jobs:
12+
build-finish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Comment PR
16+
uses: thollander/actions-comment-pull-request@v2
17+
with:
18+
message: ${{github.event.client_payload.release-url}}
19+
pr_number: ${{github.event.client_payload.pr-number}}
20+
comment_tag: ci-bot

0 commit comments

Comments
 (0)