Skip to content

Commit bf640e9

Browse files
author
archurtan
committed
在workflow中添加'将CI结果通知至企微'的功能
Change-Id: Ia70f4a677dd3568cb955a9e8db4c00f188496c42 (cherry picked from commit 5d5cb3b)
1 parent a8071f2 commit bf640e9

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-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-link-android/actions)"\n
22+
}
23+
}'

.github/workflows/opensource.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ env:
1414
IOT_SONATYPE_USERNAME: ${{ secrets.IOT_SONATYPE_USERNAME }}
1515
IOT_SONATYPE_PASSWORD: ${{ secrets.IOT_SONATYPE_PASSWORD }}
1616
GPG_DECRYPT_PASSPHRASE: ${{ secrets.GPG_DECRYPT_PASSPHRASE }}
17+
IOT_WECOM_CID_ROBOT_KEY: ${{ secrets.IOT_WECOM_CID_ROBOT_KEY }}
1718

1819
jobs:
1920
build:
@@ -84,3 +85,13 @@ jobs:
8485
fir publish $demoApk -T $IOT_FIRIM_API_TOKEN -c "$rl" --oversea_turbo --force_pin_history -V
8586
env:
8687
IOT_FIRIM_API_TOKEN: ${{ secrets.IOT_FIRIM_API_TOKEN }}
88+
- name: Report success result to wecom
89+
if: ${{ success() }}
90+
run: |
91+
echo success!!!
92+
bash .github/scripts/send_result_to_wecom.sh ${{ github.event.repository.name }} success
93+
- name: Report fail result to wecom
94+
if: ${{ failure() }}
95+
run: |
96+
echo fail!!!
97+
bash .github/scripts/send_result_to_wecom.sh ${{ github.event.repository.name }} fail

.github/workflows/tencent_official.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ env:
1212
IOT_GPG_KEYNAME: ${{ secrets.IOT_GPG_KEYNAME }}
1313
IOT_GPG_PASSPHRASE: ${{ secrets.IOT_GPG_PASSPHRASE }}
1414
IOT_GITHUB_ACCESS_TOKEN: ${{ secrets.IOT_GITHUB_ACCESS_TOKEN }}
15+
IOT_WECOM_CID_ROBOT_KEY: ${{ secrets.IOT_WECOM_CID_ROBOT_KEY }}
1516

1617
jobs:
1718
build:
@@ -163,3 +164,13 @@ jobs:
163164
fir publish $demoApk -T $IOT_FIRIM_API_TOKEN -c "$rl" --oversea_turbo --force_pin_history -V
164165
env:
165166
IOT_FIRIM_API_TOKEN: ${{ secrets.IOT_FIRIM_API_TOKEN }}
167+
- name: Report success result to wecom
168+
if: ${{ success() }}
169+
run: |
170+
echo success!!!
171+
bash .github/scripts/send_result_to_wecom.sh ${{ github.event.repository.name }} success
172+
- name: Report fail result to wecom
173+
if: ${{ failure() }}
174+
run: |
175+
echo fail!!!
176+
bash .github/scripts/send_result_to_wecom.sh ${{ github.event.repository.name }} fail

0 commit comments

Comments
 (0)