forked from olachat/gola
-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (39 loc) · 1.32 KB
/
notify_wecom.yml
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
# This workflow add GitHub issues to Project and label them for triage upon creation
name: WeCom test
on:
issues:
types:
- opened
- reopened
jobs:
notify_wecom:
name: send bug notification to wecom
runs-on: ubuntu-latest
if: ${{ contains(github.event.issue.labels.*.name, 'bug') }}
steps:
- name: Send notification to WeCom
if: ${{ contains(github.event.issue.labels.*.name, 'bug') }}
run: |
content=$(cat<<EOF | sed -e '/<!--/d' | sed -e 's/ ###//g' | jq -Rs '.'
# <font color=\"warning\">${{ github.event.issue.title }}</font>
<font color=\"comment\">${{ github.event.issue.user.login }}</font>
${{ github.event.issue.body }}
[查看原文](${{ github.event.issue.html_url }})
EOF
)
cat<<EOF | curl -s '${{ secrets.BOT_URL }}' -H 'Content-Type: application/json' -d @-
{
"msgtype": "markdown",
"markdown": {
"content": $content
}
}
EOF
cat<<EOF | curl -s '${{ secrets.BOT_URL }}' -H 'Content-Type: application/json' -d @-
{
"msgtype": "text",
"text": {
"content": "${{ github.event.issue.html_url }}"
}
}
EOF