-
Notifications
You must be signed in to change notification settings - Fork 1
69 lines (60 loc) · 1.93 KB
/
pr-comment.yml
File metadata and controls
69 lines (60 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: PR Comment
on:
workflow_call:
inputs:
status:
required: true
type: string
ref:
required: true
type: string
run_number:
required: true
type: string
message:
required: false
type: string
author:
required: false
type: string
run_id:
required: true
type: string
pr_number:
required: true
type: string
repository:
required: false
type: string
secrets:
ACCESS_TOKEN:
required: true
jobs:
comment:
runs-on: ubuntu-latest
steps:
- name: Set author display
id: set-author
run: |
if [ "${{ inputs.status }}" != "success" ] && [ -n "${{ inputs.author }}" ]; then
echo "author_display=@${{ inputs.author }}" >> $GITHUB_OUTPUT
else
echo "author_display=${{ inputs.author }}" >> $GITHUB_OUTPUT
fi
- name: Create comment
uses: peter-evans/create-or-update-comment@v5
with:
token: ${{ secrets.ACCESS_TOKEN }}
repository: ${{ inputs.repository }}
issue-number: ${{ inputs.pr_number }}
body: |
## ${{ inputs.status == 'success' && '🚀 构建成功啦!' || '❌ 构建失败了!' }}
### 🌟 构建详情
- **分支**:`${{ inputs.ref }}`
- **构建编号**:#${{ inputs.run_number }}
- **提交信息**:${{ inputs.message }}
- **提交者**:${{ steps.set-author.outputs.author_display }}
---
${{ inputs.status == 'success' && '✨ 构建已经完成,可以合并!' || '😱 糟糕!构建出现了问题,请及时检查!' }}
[查看详情 👉](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ inputs.run_id }})
reactions: ${{ inputs.status == 'success' && '+1' || 'eyes' }}