Skip to content

Commit 83c7541

Browse files
author
archurtan
committed
在device python仓库中添加workflow结果通知功能
Change-Id: I5b747496b81ae667ed79c956b3d220aba99773f4
1 parent 59ae245 commit 83c7541

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
3+
color=""
4+
if [ $2 == "success" ]
5+
then
6+
echo "success"
7+
color="info"
8+
else
9+
echo "fail"
10+
color="warning"
11+
fi
12+
13+
curl "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=$IOT_WECOM_CID_ROBOT_KEY" \
14+
-H 'Content-Type: application/json' \
15+
-d '
16+
{
17+
"msgtype": "markdown",
18+
"markdown": {
19+
"content": "**repo: \"'"$1"'\"**\n
20+
>result:<font color=\"'"$color"'\">\"'"$2"'\"</font>\n
21+
>[action](https://github.com/tencentyun/iot-device-python/actions)"\n
22+
}
23+
}'

.github/workflows/pypi_publish.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
- '**.md'
88
- 'LICENSE'
99

10+
env:
11+
IOT_WECOM_CID_ROBOT_KEY: ${{ secrets.IOT_WECOM_CID_ROBOT_KEY }}
12+
1013
jobs:
1114

1215
build:
@@ -60,3 +63,13 @@ jobs:
6063
sed -i "s#version=.*#version=\"$VERSION\",#g" setup.py
6164
python setup.py sdist bdist_wheel
6265
twine upload dist/*
66+
- name: Report success result to wecom
67+
if: ${{ success() }}
68+
run: |
69+
echo success!!!
70+
bash .github/scripts/send_result_to_wecom.sh ${{ github.event.repository.name }} success
71+
- name: Report fail result to wecom
72+
if: ${{ failure() }}
73+
run: |
74+
echo fail!!!
75+
bash .github/scripts/send_result_to_wecom.sh ${{ github.event.repository.name }} fail

0 commit comments

Comments
 (0)