2 Commits

Author SHA1 Message Date
guanhongfu
07415b7499 feat: 支持模板卡片类型消息;升级依赖;异常处理优化; 2022-09-14 11:49:45 +08:00
guanhongfu
46370aa1f7 feat: 升级依赖;文件结构优化;异常处理优化; 2022-04-27 10:20:40 +08:00
19 changed files with 2673 additions and 21846 deletions

View File

@@ -15,7 +15,7 @@ jobs:
WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}}
with:
msgtype: text
content: 广州今日天气29度大部分多云降雨概率60%
content: "广州今日天气29度大部分多云降雨概率60%"
mentioned_list: '["@all"]'
# markdown类型
@@ -57,3 +57,21 @@ jobs:
with:
msgtype: file
media_id: 2eNNDDAZxBnhGvz_KafNtCGC5lZOwJraS5BEe8EvzNAncouNQQrAghfE47uV5RGrg
# 模版卡片类型 - 文本通知模版卡片
- name: WeChat Work notification by template_card.text_notice
uses: chf007/action-wechat-work@master
env:
WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}}
with:
msgtype: template_card
template_card: '{"card_type":"text_notice","source":{"icon_url":"https://wework.qpic.cn/wwpic/252813_jOfDHtcISzuodLa_1629280209/0","desc":"企业微信","desc_color":0},"main_title":{"title":"欢迎使用企业微信","desc":"您的好友正在邀请您加入企业微信"},"emphasis_content":{"title":"100","desc":"数据含义"},"quote_area":{"type":1,"url":"https://work.weixin.qq.com/?from=openApi","appid":"APPID","pagepath":"PAGEPATH","title":"引用文本标题","quote_text":"Jack企业微信真的很好用~\nBalian超级好的一款软件"},"sub_title_text":"下载企业微信还能抢红包!","horizontal_content_list":[{"keyname":"邀请人","value":"张三"},{"keyname":"企微官网","value":"点击访问","type":1,"url":"https://work.weixin.qq.com/?from=openApi"},{"keyname":"企微下载","value":"企业微信.apk","type":2,"media_id":"MEDIAID"}],"jump_list":[{"type":1,"url":"https://work.weixin.qq.com/?from=openApi","title":"企业微信官网"},{"type":2,"appid":"APPID","pagepath":"PAGEPATH","title":"跳转小程序"}],"card_action":{"type":1,"url":"https://work.weixin.qq.com/?from=openApi","appid":"APPID","pagepath":"PAGEPATH"}}'
# 模版卡片类型 - 图文展示模版卡片
- name: WeChat Work notification by template_card.news_notice
uses: chf007/action-wechat-work@master
env:
WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}}
with:
msgtype: template_card
template_card: '{"card_type":"news_notice","source":{"icon_url":"https://wework.qpic.cn/wwpic/252813_jOfDHtcISzuodLa_1629280209/0","desc":"企业微信","desc_color":0},"main_title":{"title":"欢迎使用企业微信","desc":"您的好友正在邀请您加入企业微信"},"card_image":{"url":"https://wework.qpic.cn/wwpic/354393_4zpkKXd7SrGMvfg_1629280616/0","aspect_ratio":2.25},"image_text_area":{"type":1,"url":"https://work.weixin.qq.com","title":"欢迎使用企业微信","desc":"您的好友正在邀请您加入企业微信","image_url":"https://wework.qpic.cn/wwpic/354393_4zpkKXd7SrGMvfg_1629280616/0"},"quote_area":{"type":1,"url":"https://work.weixin.qq.com/?from=openApi","appid":"APPID","pagepath":"PAGEPATH","title":"引用文本标题","quote_text":"Jack企业微信真的很好用~\nBalian超级好的一款软件"},"vertical_content_list":[{"title":"惊喜红包等你来拿","desc":"下载企业微信还能抢红包!"}],"horizontal_content_list":[{"keyname":"邀请人","value":"张三"},{"keyname":"企微官网","value":"点击访问","type":1,"url":"https://work.weixin.qq.com/?from=openApi"},{"keyname":"企微下载","value":"企业微信.apk","type":2,"media_id":"MEDIAID"}],"jump_list":[{"type":1,"url":"https://work.weixin.qq.com/?from=openApi","title":"企业微信官网"},{"type":2,"appid":"APPID","pagepath":"PAGEPATH","title":"跳转小程序"}],"card_action":{"type":1,"url":"https://work.weixin.qq.com/?from=openApi","appid":"APPID","pagepath":"PAGEPATH"}}'

View File

@@ -1,17 +0,0 @@
FROM mhart/alpine-node:10.15.1
LABEL "com.github.actions.name"="GitHub Action for WeChat Work"
LABEL "com.github.actions.description"="Send WeChat Work message. Run on any operating platform, such as Windows, Linux, Mac supported by GitHub"
LABEL "com.github.actions.icon"="message-circle"
LABEL "com.github.actions.color"="red"
LABEL "repository"="https://github.com/chf007/action-wechat-work"
LABEL "homepage"="https://github.com/chf007/action-wechat-work"
LABEL "maintainer"="chf007 <chf007server@gmail.com>"
LABEL "version"="1.0.4"
ADD entrypoint.js package.json package-lock.json /
RUN npm ci
RUN chmod +x /entrypoint.js
ENTRYPOINT ["node", "/entrypoint.js"]

109
README.md
View File

@@ -2,7 +2,7 @@
通过企业微信机器人发送消息。
![WeChat Work Logo](wechat-work-logo.png "WeChat Work Logo")
![WeChat Work Logo](./docs/wechat-work-logo.png "WeChat Work Logo")
<hr/>
@@ -10,7 +10,7 @@
### 纯文本格式消息
![WeChat Work message](wechat-work-msg-text.png "WeChat Work message")
![WeChat Work message](./docs/wechat-work-msg-text.png "WeChat Work message")
```yaml
- name: WeChat Work notification by text
@@ -19,21 +19,21 @@
WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}}
with:
msgtype: text
content: 广州今日天气29 度大部分多云降雨概率60%
content: "广州今日天气29 度大部分多云降雨概率60%"
mentioned_list: '["wangqing","@all"]'
mentioned_mobile_list: '["13800001111","@all"]'
```
参数 | 必须 | 说明
------------ | ------------- | -------------
msgtype | true | 消息类型,此时固定为 text
content | true | 文本内容,最长不超过 2048 个字节,必须是 utf8 编码
mentioned_list | false | userid 的列表,提醒群中的指定成员(@某个成员)@all表示提醒所有人,如果开发者获取不到 userid可以使用 mentioned_mobile_list必须是序列化后的 JSON 字符串
mentioned_mobile_list | false | 手机号列表,提醒手机号对应的群成员(@某个成员)@all表示提醒所有人,必须是序列化后的 JSON 字符串
| 参数 | 必须 | 说明 |
|-----------------------|-------|-------------------------------------------------------------------------------------------------------|
| msgtype | true | 消息类型,此时固定为 text |
| content | true | 文本内容,最长不超过 2048 个字节,必须是 utf8 编码 |
| mentioned_list | false | userid 的列表,提醒群中的指定成员(@某个成员)@all表示提醒所有人,如果开发者获取不到 userid可以使用 mentioned_mobile_list必须是序列化后的 JSON 字符串 |
| mentioned_mobile_list | false | 手机号列表,提醒手机号对应的群成员(@某个成员)@all表示提醒所有人,必须是序列化后的 JSON 字符串 |
### Markdown 格式消息
![WeChat Work message](wechat-work-msg-markdown.png "WeChat Work message")
![WeChat Work message](./docs/wechat-work-msg-markdown.png "WeChat Work message")
```yaml
- name: WeChat Work notification by markdown
@@ -48,14 +48,14 @@ mentioned_mobile_list | false | 手机号列表,提醒手机号对应的群成
> VIP用户反馈:<font color=\"comment\">15例</font>"
```
参数 | 必须 | 说明
------------ | ------------- | -------------
msgtype | true | 消息类型,此时固定为 markdown
content | true | markdown 内容,最长不超过 4096 个字节,必须是 utf8 编码 支持的格式详见 https://work.weixin.qq.com/api/doc/90000/90136/91770
| 参数 | 必须 | 说明 |
|---------|------|-----------------------------------------------------------------------------------------------------|
| msgtype | true | 消息类型,此时固定为 markdown |
| content | true | markdown 内容,最长不超过 4096 个字节,必须是 utf8 编码 支持的格式详见 https://work.weixin.qq.com/api/doc/90000/90136/91770 |
### 图片格式消息
![WeChat Work message](wechat-work-msg-image.png "WeChat Work message")
![WeChat Work message](./docs/wechat-work-msg-image.png "WeChat Work message")
```yaml
- name: WeChat Work notification by image
@@ -68,15 +68,15 @@ content | true | markdown 内容,最长不超过 4096 个字节,必须是 ut
md5: 0582d8564cdee3187207666898f75205
```
参数 | 必须 | 说明
------------ | ------------- | -------------
msgtype | true | 消息类型,此时固定为 image
base64 | true | 图片内容的 base64 编码 注图片base64 编码前)最大不能超过 2 M支持 JPG、PNG 格式
md5 | true | 图片内容base64 编码前)的 md5 值
| 参数 | 必须 | 说明 |
|---------|------|----------------------------------------------------------|
| msgtype | true | 消息类型,此时固定为 image |
| base64 | true | 图片内容的 base64 编码 注图片base64 编码前)最大不能超过 2 M支持 JPG、PNG 格式 |
| md5 | true | 图片内容base64 编码前)的 md5 值 |
### 图文格式消息
![WeChat Work message](wechat-work-msg-news.png "WeChat Work message")
![WeChat Work message](./docs/wechat-work-msg-news.png "WeChat Work message")
```yaml
- name: WeChat Work notification by news
@@ -85,20 +85,20 @@ md5 | true | 图片内容base64 编码前)的 md5 值
WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}}
with:
msgtype: news
articles: '[{"title":"中秋节礼品领取","description":"今年中秋节公司有豪礼相送","url":"URL","picurl":"http://res.mail.qq.com/node/ww/wwopenmng/images/independent/doc/test_pic_msg1.png"}]'
articles: '[{"title":"中秋节礼品领取","description":"今年中秋节公司有豪礼相送","url":"URL","picurl":"https://res.mail.qq.com/node/ww/wwopenmng/images/independent/doc/test_pic_msg1.png"}]'
```
参数 | 必须 | 说明
------------ | ------------- | -------------
msgtype | true | 消息类型,此时固定为 news
articles | true | 图文消息,一个图文消息支持 1 到 8 条图文,必须是序列化后的 JSON 字符串
articles.title | true | 标题,不超过 128 个字节,超过会自动截断
articles.description | false | 描述,不超过 512 个字节,超过会自动截断
articles.url | false | 点击后跳转的链接。
articles.picurl | false | 图文消息的图片链接,支持 JPG、PNG 格式,较好的效果为大图 1068*455小图 150*150。
| 参数 | 必须 | 说明 |
|----------------------|-------|-------------------------------------------------------|
| msgtype | true | 消息类型,此时固定为 news |
| articles | true | 图文消息,一个图文消息支持 1 到 8 条图文,必须是序列化后的 JSON 字符串 |
| articles.title | true | 标题,不超过 128 个字节,超过会自动截断 |
| articles.description | false | 描述,不超过 512 个字节,超过会自动截断 |
| articles.url | false | 点击后跳转的链接。 |
| articles.picurl | false | 图文消息的图片链接,支持 JPG、PNG 格式,较好的效果为大图 1068*455小图 150*150。 |
### 文件格式消息
![WeChat Work message](wechat-work-msg-file.png "WeChat Work message")
![WeChat Work message](./docs/wechat-work-msg-file.png "WeChat Work message")
```yaml
- name: WeChat Work notification by file
@@ -110,10 +110,49 @@ articles.picurl | false | 图文消息的图片链接,支持 JPG、PNG 格式
media_id: 3a8asd892asd8asd
```
参数 | 必须 | 说明
------------ | ------------- | -------------
msgtype | true | 消息类型,此时固定为 file
media_id | true | 文件 id通过 [文件上传接口](https://work.weixin.qq.com/api/doc/90000/90136/91770) 获取
| 参数 | 必须 | 说明 |
|----------|------|----------------------------------------------------------------------------|
| msgtype | true | 消息类型,此时固定为 file |
| media_id | true | 文件 id通过 [文件上传接口](https://work.weixin.qq.com/api/doc/90000/90136/91770) 获取 |
### 模版卡片类型消息 - 文本通知模版卡片
![WeChat Work message](./docs/wechat-work-msg-text-notice.webp "WeChat Work message")
```yaml
- name: WeChat Work notification by template_card.text_notice
uses: chf007/action-wechat-work@master
env:
WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}}
with:
msgtype: template_card
template_card: '{"card_type":"text_notice","source":{"icon_url":"https://wework.qpic.cn/wwpic/252813_jOfDHtcISzuodLa_1629280209/0","desc":"企业微信","desc_color":0},"main_title":{"title":"欢迎使用企业微信","desc":"您的好友正在邀请您加入企业微信"},"emphasis_content":{"title":"100","desc":"数据含义"},"quote_area":{"type":1,"url":"https://work.weixin.qq.com/?from=openApi","appid":"APPID","pagepath":"PAGEPATH","title":"引用文本标题","quote_text":"Jack企业微信真的很好用~\nBalian超级好的一款软件"},"sub_title_text":"下载企业微信还能抢红包!","horizontal_content_list":[{"keyname":"邀请人","value":"张三"},{"keyname":"企微官网","value":"点击访问","type":1,"url":"https://work.weixin.qq.com/?from=openApi"},{"keyname":"企微下载","value":"企业微信.apk","type":2,"media_id":"MEDIAID"}],"jump_list":[{"type":1,"url":"https://work.weixin.qq.com/?from=openApi","title":"企业微信官网"},{"type":2,"appid":"APPID","pagepath":"PAGEPATH","title":"跳转小程序"}],"card_action":{"type":1,"url":"https://work.weixin.qq.com/?from=openApi","appid":"APPID","pagepath":"PAGEPATH"}}'
```
| 参数 | 必须 | 说明 |
|---------|------|-----------------------------------------------------------------------------------------------------|
| msgtype | true | 消息类型,此时固定为 template_card |
| template_card | true | 模版卡片参数,必须是序列化后的 JSON 字符串,参数详见 https://developer.work.weixin.qq.com/document/path/91770#%E6%A8%A1%E7%89%88%E5%8D%A1%E7%89%87%E7%B1%BB%E5%9E%8B |
### 模版卡片类型消息 - 图文展示模版卡片
![WeChat Work message](./docs/wechat-work-msg-news-notice.webp "WeChat Work message")
```yaml
- name: WeChat Work notification by template_card.news_notice
uses: chf007/action-wechat-work@master
env:
WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}}
with:
msgtype: template_card
template_card: '{"card_type":"news_notice","source":{"icon_url":"https://wework.qpic.cn/wwpic/252813_jOfDHtcISzuodLa_1629280209/0","desc":"企业微信","desc_color":0},"main_title":{"title":"欢迎使用企业微信","desc":"您的好友正在邀请您加入企业微信"},"card_image":{"url":"https://wework.qpic.cn/wwpic/354393_4zpkKXd7SrGMvfg_1629280616/0","aspect_ratio":2.25},"image_text_area":{"type":1,"url":"https://work.weixin.qq.com","title":"欢迎使用企业微信","desc":"您的好友正在邀请您加入企业微信","image_url":"https://wework.qpic.cn/wwpic/354393_4zpkKXd7SrGMvfg_1629280616/0"},"quote_area":{"type":1,"url":"https://work.weixin.qq.com/?from=openApi","appid":"APPID","pagepath":"PAGEPATH","title":"引用文本标题","quote_text":"Jack企业微信真的很好用~\nBalian超级好的一款软件"},"vertical_content_list":[{"title":"惊喜红包等你来拿","desc":"下载企业微信还能抢红包!"}],"horizontal_content_list":[{"keyname":"邀请人","value":"张三"},{"keyname":"企微官网","value":"点击访问","type":1,"url":"https://work.weixin.qq.com/?from=openApi"},{"keyname":"企微下载","value":"企业微信.apk","type":2,"media_id":"MEDIAID"}],"jump_list":[{"type":1,"url":"https://work.weixin.qq.com/?from=openApi","title":"企业微信官网"},{"type":2,"appid":"APPID","pagepath":"PAGEPATH","title":"跳转小程序"}],"card_action":{"type":1,"url":"https://work.weixin.qq.com/?from=openApi","appid":"APPID","pagepath":"PAGEPATH"}}'
```
| 参数 | 必须 | 说明 |
|---------|------|-----------------------------------------------------------------------------------------------------|
| msgtype | true | 消息类型,此时固定为 template_card |
| template_card | true | 模版卡片参数,必须是序列化后的 JSON 字符串,参数详见 https://developer.work.weixin.qq.com/document/path/91770#%E6%A8%A1%E7%89%88%E5%8D%A1%E7%89%87%E7%B1%BB%E5%9E%8B |
### WECHAT_WORK_BOT_WEBHOOK

File diff suppressed because one or more lines are too long

View File

@@ -8,7 +8,7 @@ branding:
inputs:
msgtype:
description: '消息类型,当前支持 text markdown image news file'
description: '消息类型,当前支持 text markdown image news file template_card'
required: true
content:
description: '当 msgtype=text 时:文本内容,最长不超过 2048 个字节,必须是 utf8 编码;当 msgtype=text 时markdown 内容,最长不超过 4096 个字节,必须是 utf8 编码 支持的格式详见 https://work.weixin.qq.com/api/doc/90000/90136/91770'
@@ -31,7 +31,10 @@ inputs:
media_id:
description: '文件 id通过 [文件上传接口](https://work.weixin.qq.com/api/doc/90000/90136/91770) 获取'
required: false
template_card:
description: '模版卡片参数,必须是序列化后的 JSON 字符串,参数详见 https://developer.work.weixin.qq.com/document/path/91770#%E6%A8%A1%E7%89%88%E5%8D%A1%E7%89%87%E7%B1%BB%E5%9E%8B'
required: false
runs:
using: 'node12'
using: 'node16'
main: 'dist/index.js'

23564
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 9.7 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

View File

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 KiB

View File

Before

Width:  |  Height:  |  Size: 176 KiB

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

@@ -1,99 +0,0 @@
const axios = require('axios');
const _ = require('lodash');
const { argv } = require('yargs');
const payload = {};
if (process.env.INPUT_MSGTYPE === 'text') {
payload.msgtype = process.env.INPUT_MSGTYPE;
payload.text = {
content: process.env.INPUT_CONTENT,
};
if (process.env.INPUT_MENTIONED_LIST) {
let mentioned_list;
try {
mentioned_list = JSON.parse(process.env.INPUT_MENTIONED_LIST);
} catch (error) {
mentioned_list = [];
}
payload.text.mentioned_list = mentioned_list;
}
if (process.env.INPUT_MENTIONED_MOBILE_LIST) {
let mentioned_mobile_list;
try {
mentioned_mobile_list = JSON.parse(process.env.INPUT_MENTIONED_MOBILE_LIST);
} catch (error) {
mentioned_mobile_list = [];
}
payload.text.mentioned_mobile_list = mentioned_mobile_list;
}
}
if (process.env.INPUT_MSGTYPE === 'markdown') {
payload.msgtype = process.env.INPUT_MSGTYPE;
payload.markdown = {
content: process.env.INPUT_CONTENT,
};
}
if (process.env.INPUT_MSGTYPE === 'image') {
payload.msgtype = process.env.INPUT_MSGTYPE;
payload.image = {
base64: process.env.INPUT_BASE64,
md5: process.env.INPUT_MD5,
};
}
if (process.env.INPUT_MSGTYPE === 'news') {
payload.msgtype = process.env.INPUT_MSGTYPE;
let articles;
try {
articles = JSON.parse(process.env.INPUT_ARTICLES);
} catch (error) {
articles = [];
}
payload.news = {
articles,
};
}
if (process.env.INPUT_MSGTYPE === 'file') {
payload.msgtype = process.env.INPUT_MSGTYPE;
payload.file = {
media_id: process.env.INPUT_MEDIA_ID,
};
}
console.log('The message content in JSON format...');
console.log(JSON.stringify(payload));
const url = process.env.WECHAT_WORK_BOT_WEBHOOK;
(async () => {
console.log('Sending message ...');
await axios.post(url, JSON.stringify(payload), {
headers: {
'Content-Type': 'application/json'
},
});
console.log('Message sent Success! Shutting down ...');
process.exit(0);
})()
.catch((err) => {
console.error(err.message);
console.error('Message sent error:', err.response.data);
process.exit(1);
});

355
package-lock.json generated
View File

@@ -1,355 +0,0 @@
{
"name": "action-wechat-work",
"version": "1.0.5",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "action-wechat-work",
"version": "1.0.5",
"license": "MIT",
"dependencies": {
"@vercel/ncc": "^0.33.1",
"axios": "^0.24.0",
"lodash": "^4.17.21",
"yargs": "^17.3.1"
}
},
"node_modules/@vercel/ncc": {
"version": "0.33.1",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.1.tgz",
"integrity": "sha512-Mlsps/P0PLZwsCFtSol23FGqT3FhBGb4B1AuGQ52JTAtXhak+b0Fh/4T55r0/SVQPeRiX9pNItOEHwakGPmZYA==",
"bin": {
"ncc": "dist/ncc/cli.js"
}
},
"node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
"engines": {
"node": ">=8"
}
},
"node_modules/ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dependencies": {
"color-convert": "^2.0.1"
},
"engines": {
"node": ">=8"
},
"funding": {
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
"node_modules/axios": {
"version": "0.24.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz",
"integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==",
"dependencies": {
"follow-redirects": "^1.14.4"
}
},
"node_modules/cliui": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
"integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
"dependencies": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0",
"wrap-ansi": "^7.0.0"
}
},
"node_modules/color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dependencies": {
"color-name": "~1.1.4"
},
"engines": {
"node": ">=7.0.0"
}
},
"node_modules/color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"node_modules/emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
},
"node_modules/escalade": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
"integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==",
"engines": {
"node": ">=6"
}
},
"node_modules/follow-redirects": {
"version": "1.14.6",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz",
"integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
},
"node_modules/get-caller-file": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
"engines": {
"node": "6.* || 8.* || >= 10.*"
}
},
"node_modules/is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"engines": {
"node": ">=8"
}
},
"node_modules/lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"node_modules/require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=",
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"dependencies": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"dependencies": {
"ansi-regex": "^5.0.1"
},
"engines": {
"node": ">=8"
}
},
"node_modules/wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"dependencies": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
}
},
"node_modules/y18n": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
"engines": {
"node": ">=10"
}
},
"node_modules/yargs": {
"version": "17.3.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.3.1.tgz",
"integrity": "sha512-WUANQeVgjLbNsEmGk20f+nlHgOqzRFpiGWVaBrYGYIGANIIu3lWjoyi0fNlFmJkvfhCZ6BXINe7/W2O2bV4iaA==",
"dependencies": {
"cliui": "^7.0.2",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"require-directory": "^2.1.1",
"string-width": "^4.2.3",
"y18n": "^5.0.5",
"yargs-parser": "^21.0.0"
},
"engines": {
"node": ">=12"
}
},
"node_modules/yargs-parser": {
"version": "21.0.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.0.tgz",
"integrity": "sha512-z9kApYUOCwoeZ78rfRYYWdiU/iNL6mwwYlkkZfJoyMR1xps+NEBX5X7XmRpxkZHhXJ6+Ey00IwKxBBSW9FIjyA==",
"engines": {
"node": ">=12"
}
}
},
"dependencies": {
"@vercel/ncc": {
"version": "0.33.1",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.1.tgz",
"integrity": "sha512-Mlsps/P0PLZwsCFtSol23FGqT3FhBGb4B1AuGQ52JTAtXhak+b0Fh/4T55r0/SVQPeRiX9pNItOEHwakGPmZYA=="
},
"ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="
},
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"requires": {
"color-convert": "^2.0.1"
}
},
"axios": {
"version": "0.24.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz",
"integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==",
"requires": {
"follow-redirects": "^1.14.4"
}
},
"cliui": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
"integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
"requires": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0",
"wrap-ansi": "^7.0.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
},
"escalade": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
"integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw=="
},
"follow-redirects": {
"version": "1.14.6",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz",
"integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A=="
},
"get-caller-file": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="
},
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="
},
"lodash": {
"version": "4.17.21",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
"integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
},
"require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
"integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I="
},
"string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.1"
}
},
"strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
"requires": {
"ansi-regex": "^5.0.1"
}
},
"wrap-ansi": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"requires": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
}
},
"y18n": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA=="
},
"yargs": {
"version": "17.3.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.3.1.tgz",
"integrity": "sha512-WUANQeVgjLbNsEmGk20f+nlHgOqzRFpiGWVaBrYGYIGANIIu3lWjoyi0fNlFmJkvfhCZ6BXINe7/W2O2bV4iaA==",
"requires": {
"cliui": "^7.0.2",
"escalade": "^3.1.1",
"get-caller-file": "^2.0.5",
"require-directory": "^2.1.1",
"string-width": "^4.2.3",
"y18n": "^5.0.5",
"yargs-parser": "^21.0.0"
}
},
"yargs-parser": {
"version": "21.0.0",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.0.0.tgz",
"integrity": "sha512-z9kApYUOCwoeZ78rfRYYWdiU/iNL6mwwYlkkZfJoyMR1xps+NEBX5X7XmRpxkZHhXJ6+Ey00IwKxBBSW9FIjyA=="
}
}
}

View File

@@ -1,11 +1,11 @@
{
"name": "action-wechat-work",
"version": "1.0.6",
"version": "1.0.8",
"description": "GitHub Action that sends a WeChat Work notification.",
"private": true,
"scripts": {
"test": "npm test",
"build": "ncc build entrypoint.js"
"build": "ncc build src/entrypoint.js"
},
"repository": {
"type": "git",
@@ -25,9 +25,9 @@
},
"homepage": "https://github.com/chf007/action-wechat-work#readme",
"dependencies": {
"@vercel/ncc": "^0.33.1",
"axios": "^0.24.0",
"lodash": "^4.17.21",
"yargs": "^17.3.1"
"axios": "^0.27.2"
},
"devDependencies": {
"@vercel/ncc": "^0.34.0"
}
}

74
pnpm-lock.yaml generated Normal file
View File

@@ -0,0 +1,74 @@
lockfileVersion: 5.4
specifiers:
'@vercel/ncc': ^0.34.0
axios: ^0.27.2
dependencies:
axios: 0.27.2
devDependencies:
'@vercel/ncc': 0.34.0
packages:
/@vercel/ncc/0.34.0:
resolution: {integrity: sha512-G9h5ZLBJ/V57Ou9vz5hI8pda/YQX5HQszCs3AmIus3XzsmRn/0Ptic5otD3xVST8QLKk7AMk7AqpsyQGN7MZ9A==}
hasBin: true
dev: true
/asynckit/0.4.0:
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
dev: false
/axios/0.27.2:
resolution: {integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==}
dependencies:
follow-redirects: 1.15.2
form-data: 4.0.0
transitivePeerDependencies:
- debug
dev: false
/combined-stream/1.0.8:
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
engines: {node: '>= 0.8'}
dependencies:
delayed-stream: 1.0.0
dev: false
/delayed-stream/1.0.0:
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
engines: {node: '>=0.4.0'}
dev: false
/follow-redirects/1.15.2:
resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==}
engines: {node: '>=4.0'}
peerDependencies:
debug: '*'
peerDependenciesMeta:
debug:
optional: true
dev: false
/form-data/4.0.0:
resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==}
engines: {node: '>= 6'}
dependencies:
asynckit: 0.4.0
combined-stream: 1.0.8
mime-types: 2.1.35
dev: false
/mime-db/1.52.0:
resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
engines: {node: '>= 0.6'}
dev: false
/mime-types/2.1.35:
resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==}
engines: {node: '>= 0.6'}
dependencies:
mime-db: 1.52.0
dev: false

139
src/entrypoint.js Normal file
View File

@@ -0,0 +1,139 @@
const axios = require('axios');
const payload = {};
if (process.env.INPUT_MSGTYPE === 'text') {
payload.msgtype = process.env.INPUT_MSGTYPE;
if (!process.env.INPUT_CONTENT) {
console.log(`[action-wechat-work] INPUT_CONTENT is blank: ${process.env.INPUT_CONTENT}`);
}
payload.text = {
content: process.env.INPUT_CONTENT,
};
if (process.env.INPUT_MENTIONED_LIST) {
let mentioned_list;
try {
mentioned_list = JSON.parse(process.env.INPUT_MENTIONED_LIST);
} catch (error) {
mentioned_list = [];
console.log(`[action-wechat-work] INPUT_MENTIONED_LIST JSON.parse error: ${error}, JSON string: ${process.env.INPUT_MENTIONED_LIST}`);
}
payload.text.mentioned_list = mentioned_list;
}
if (process.env.INPUT_MENTIONED_MOBILE_LIST) {
let mentioned_mobile_list;
try {
mentioned_mobile_list = JSON.parse(process.env.INPUT_MENTIONED_MOBILE_LIST);
} catch (error) {
mentioned_mobile_list = [];
console.log(`[action-wechat-work] INPUT_MENTIONED_MOBILE_LIST JSON.parse error: ${error}, JSON string: ${process.env.INPUT_MENTIONED_MOBILE_LIST}`);
}
payload.text.mentioned_mobile_list = mentioned_mobile_list;
}
}
if (process.env.INPUT_MSGTYPE === 'markdown') {
payload.msgtype = process.env.INPUT_MSGTYPE;
if (!process.env.INPUT_CONTENT) {
console.log(`[action-wechat-work] INPUT_CONTENT is blank: ${process.env.INPUT_CONTENT}`);
}
payload.markdown = {
content: process.env.INPUT_CONTENT,
};
}
if (process.env.INPUT_MSGTYPE === 'image') {
payload.msgtype = process.env.INPUT_MSGTYPE;
if (!process.env.INPUT_BASE64) {
console.log(`[action-wechat-work] INPUT_BASE64 is blank: ${process.env.INPUT_BASE64}`);
}
if (!process.env.INPUT_MD5) {
console.log(`[action-wechat-work] INPUT_MD5 is blank: ${process.env.INPUT_MD5}`);
}
payload.image = {
base64: process.env.INPUT_BASE64,
md5: process.env.INPUT_MD5,
};
}
if (process.env.INPUT_MSGTYPE === 'news') {
payload.msgtype = process.env.INPUT_MSGTYPE;
let articles;
try {
articles = JSON.parse(process.env.INPUT_ARTICLES);
} catch (error) {
articles = [];
console.log(`[action-wechat-work] INPUT_ARTICLES JSON.parse error: ${error}, JSON string: ${process.env.INPUT_ARTICLES}`);
}
payload.news = {
articles,
};
}
if (process.env.INPUT_MSGTYPE === 'file') {
payload.msgtype = process.env.INPUT_MSGTYPE;
if (!process.env.INPUT_MEDIA_ID) {
console.log(`[action-wechat-work] INPUT_MEDIA_ID is blank: ${process.env.INPUT_MEDIA_ID}`);
}
payload.file = {
media_id: process.env.INPUT_MEDIA_ID,
};
}
if (process.env.INPUT_MSGTYPE === 'template_card') {
payload.msgtype = process.env.INPUT_MSGTYPE;
let template_card;
try {
template_card = JSON.parse(process.env.INPUT_TEMPLATE_CARD);
} catch (error) {
template_card = {};
console.log(`[action-wechat-work] INPUT_TEMPLATE_CARD JSON.parse error: ${error}, JSON string: ${process.env.INPUT_TEMPLATE_CARD}`);
}
payload.template_card = template_card;
}
console.log('[action-wechat-work] The message content in JSON format...', JSON.stringify(payload));
const url = process.env.WECHAT_WORK_BOT_WEBHOOK;
(async () => {
console.log('[action-wechat-work] Sending message ...');
await axios.post(url, JSON.stringify(payload), {
headers: {
'Content-Type': 'application/json'
},
});
console.log('[action-wechat-work] Message sent Success! Shutting down ...');
process.exit(0);
})()
.catch((err) => {
console.error('[action-wechat-work] Message sent error:');
err.message && console.error(`[action-wechat-work] err.message: ${err.message}`);
err.response && err.response.data && console.error(`[action-wechat-work] err.response.data: ${err.response.data}`);
process.exit(1);
});