Skip to content

Commit 5d5cb3b

Browse files
author
archurtan
committed
在workflow中添加'将CI结果通知至企微'的功能
Change-Id: Ia70f4a677dd3568cb955a9e8db4c00f188496c42
1 parent 0e59f08 commit 5d5cb3b

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:
@@ -96,3 +97,13 @@ jobs:
9697
fir publish $demoApk -T $IOT_FIRIM_API_TOKEN -c "$rl" --oversea_turbo --force_pin_history -V
9798
env:
9899
IOT_FIRIM_API_TOKEN: ${{ secrets.IOT_FIRIM_API_TOKEN }}
100+
- name: Report success result to wecom
101+
if: ${{ success() }}
102+
run: |
103+
echo success!!!
104+
bash .github/scripts/send_result_to_wecom.sh ${{ github.event.repository.name }} success
105+
- name: Report fail result to wecom
106+
if: ${{ failure() }}
107+
run: |
108+
echo fail!!!
109+
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:
@@ -174,3 +175,13 @@ jobs:
174175
fir publish $demoApk -T $IOT_FIRIM_API_TOKEN -c "$rl" --oversea_turbo --force_pin_history -V
175176
env:
176177
IOT_FIRIM_API_TOKEN: ${{ secrets.IOT_FIRIM_API_TOKEN }}
178+
- name: Report success result to wecom
179+
if: ${{ success() }}
180+
run: |
181+
echo success!!!
182+
bash .github/scripts/send_result_to_wecom.sh ${{ github.event.repository.name }} success
183+
- name: Report fail result to wecom
184+
if: ${{ failure() }}
185+
run: |
186+
echo fail!!!
187+
bash .github/scripts/send_result_to_wecom.sh ${{ github.event.repository.name }} fail

0 commit comments

Comments
 (0)