feat: 升级依赖;文件结构优化;异常处理优化;

This commit is contained in:
guanhongfu 2022-04-27 10:20:40 +08:00
parent f99560aa94
commit 46370aa1f7
14 changed files with 2319 additions and 21475 deletions

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"]

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/> <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 ```yaml
- name: WeChat Work notification by text - name: WeChat Work notification by text
@ -24,16 +24,16 @@
mentioned_mobile_list: '["13800001111","@all"]' mentioned_mobile_list: '["13800001111","@all"]'
``` ```
参数 | 必须 | 说明 | 参数 | 必须 | 说明 |
------------ | ------------- | ------------- |-----------------------|-------|-------------------------------------------------------------------------------------------------------|
msgtype | true | 消息类型,此时固定为 text | msgtype | true | 消息类型,此时固定为 text |
content | true | 文本内容,最长不超过 2048 个字节,必须是 utf8 编码 | content | true | 文本内容,最长不超过 2048 个字节,必须是 utf8 编码 |
mentioned_list | false | userid 的列表,提醒群中的指定成员(@某个成员)@all表示提醒所有人,如果开发者获取不到 userid可以使用 mentioned_mobile_list必须是序列化后的 JSON 字符串 | mentioned_list | false | userid 的列表,提醒群中的指定成员(@某个成员)@all表示提醒所有人,如果开发者获取不到 userid可以使用 mentioned_mobile_list必须是序列化后的 JSON 字符串 |
mentioned_mobile_list | false | 手机号列表,提醒手机号对应的群成员(@某个成员)@all表示提醒所有人,必须是序列化后的 JSON 字符串 | mentioned_mobile_list | false | 手机号列表,提醒手机号对应的群成员(@某个成员)@all表示提醒所有人,必须是序列化后的 JSON 字符串 |
### Markdown 格式消息 ### 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 ```yaml
- name: WeChat Work notification by markdown - name: WeChat Work notification by markdown
@ -48,14 +48,14 @@ mentioned_mobile_list | false | 手机号列表,提醒手机号对应的群成
> VIP用户反馈:<font color=\"comment\">15例</font>" > VIP用户反馈:<font color=\"comment\">15例</font>"
``` ```
参数 | 必须 | 说明 | 参数 | 必须 | 说明 |
------------ | ------------- | ------------- |---------|------|-----------------------------------------------------------------------------------------------------|
msgtype | true | 消息类型,此时固定为 markdown | msgtype | true | 消息类型,此时固定为 markdown |
content | true | markdown 内容,最长不超过 4096 个字节,必须是 utf8 编码 支持的格式详见 https://work.weixin.qq.com/api/doc/90000/90136/91770 | 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 ```yaml
- name: WeChat Work notification by image - name: WeChat Work notification by image
@ -68,15 +68,15 @@ content | true | markdown 内容,最长不超过 4096 个字节,必须是 ut
md5: 0582d8564cdee3187207666898f75205 md5: 0582d8564cdee3187207666898f75205
``` ```
参数 | 必须 | 说明 | 参数 | 必须 | 说明 |
------------ | ------------- | ------------- |---------|------|----------------------------------------------------------|
msgtype | true | 消息类型,此时固定为 image | msgtype | true | 消息类型,此时固定为 image |
base64 | true | 图片内容的 base64 编码 注图片base64 编码前)最大不能超过 2 M支持 JPG、PNG 格式 | base64 | true | 图片内容的 base64 编码 注图片base64 编码前)最大不能超过 2 M支持 JPG、PNG 格式 |
md5 | true | 图片内容base64 编码前)的 md5 值 | 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 ```yaml
- name: WeChat Work notification by news - name: WeChat Work notification by news
@ -85,20 +85,20 @@ md5 | true | 图片内容base64 编码前)的 md5 值
WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}} WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}}
with: with:
msgtype: news 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 | msgtype | true | 消息类型,此时固定为 news |
articles | true | 图文消息,一个图文消息支持 1 到 8 条图文,必须是序列化后的 JSON 字符串 | articles | true | 图文消息,一个图文消息支持 1 到 8 条图文,必须是序列化后的 JSON 字符串 |
articles.title | true | 标题,不超过 128 个字节,超过会自动截断 | articles.title | true | 标题,不超过 128 个字节,超过会自动截断 |
articles.description | false | 描述,不超过 512 个字节,超过会自动截断 | articles.description | false | 描述,不超过 512 个字节,超过会自动截断 |
articles.url | false | 点击后跳转的链接。 | articles.url | false | 点击后跳转的链接。 |
articles.picurl | false | 图文消息的图片链接,支持 JPG、PNG 格式,较好的效果为大图 1068*455小图 150*150。 | 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 ```yaml
- name: WeChat Work notification by file - name: WeChat Work notification by file
@ -110,10 +110,10 @@ articles.picurl | false | 图文消息的图片链接,支持 JPG、PNG 格式
media_id: 3a8asd892asd8asd media_id: 3a8asd892asd8asd
``` ```
参数 | 必须 | 说明 | 参数 | 必须 | 说明 |
------------ | ------------- | ------------- |----------|------|----------------------------------------------------------------------------|
msgtype | true | 消息类型,此时固定为 file | msgtype | true | 消息类型,此时固定为 file |
media_id | true | 文件 id通过 [文件上传接口](https://work.weixin.qq.com/api/doc/90000/90136/91770) 获取 | media_id | true | 文件 id通过 [文件上传接口](https://work.weixin.qq.com/api/doc/90000/90136/91770) 获取 |
### WECHAT_WORK_BOT_WEBHOOK ### WECHAT_WORK_BOT_WEBHOOK

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/> <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 ```yaml
- name: WeChat Work notification by text - name: WeChat Work notification by text
@ -24,16 +24,16 @@
mentioned_mobile_list: '["13800001111","@all"]' mentioned_mobile_list: '["13800001111","@all"]'
``` ```
参数 | 必须 | 说明 | 参数 | 必须 | 说明 |
------------ | ------------- | ------------- |-----------------------|-------|-------------------------------------------------------------------------------------------------------|
msgtype | true | 消息类型,此时固定为 text | msgtype | true | 消息类型,此时固定为 text |
content | true | 文本内容,最长不超过 2048 个字节,必须是 utf8 编码 | content | true | 文本内容,最长不超过 2048 个字节,必须是 utf8 编码 |
mentioned_list | false | userid 的列表,提醒群中的指定成员(@某个成员)@all表示提醒所有人,如果开发者获取不到 userid可以使用 mentioned_mobile_list必须是序列化后的 JSON 字符串 | mentioned_list | false | userid 的列表,提醒群中的指定成员(@某个成员)@all表示提醒所有人,如果开发者获取不到 userid可以使用 mentioned_mobile_list必须是序列化后的 JSON 字符串 |
mentioned_mobile_list | false | 手机号列表,提醒手机号对应的群成员(@某个成员)@all表示提醒所有人,必须是序列化后的 JSON 字符串 | mentioned_mobile_list | false | 手机号列表,提醒手机号对应的群成员(@某个成员)@all表示提醒所有人,必须是序列化后的 JSON 字符串 |
### Markdown 格式消息 ### 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 ```yaml
- name: WeChat Work notification by markdown - name: WeChat Work notification by markdown
@ -48,14 +48,14 @@ mentioned_mobile_list | false | 手机号列表,提醒手机号对应的群成
> VIP用户反馈:<font color=\"comment\">15例</font>" > VIP用户反馈:<font color=\"comment\">15例</font>"
``` ```
参数 | 必须 | 说明 | 参数 | 必须 | 说明 |
------------ | ------------- | ------------- |---------|------|-----------------------------------------------------------------------------------------------------|
msgtype | true | 消息类型,此时固定为 markdown | msgtype | true | 消息类型,此时固定为 markdown |
content | true | markdown 内容,最长不超过 4096 个字节,必须是 utf8 编码 支持的格式详见 https://work.weixin.qq.com/api/doc/90000/90136/91770 | 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 ```yaml
- name: WeChat Work notification by image - name: WeChat Work notification by image
@ -68,15 +68,15 @@ content | true | markdown 内容,最长不超过 4096 个字节,必须是 ut
md5: 0582d8564cdee3187207666898f75205 md5: 0582d8564cdee3187207666898f75205
``` ```
参数 | 必须 | 说明 | 参数 | 必须 | 说明 |
------------ | ------------- | ------------- |---------|------|----------------------------------------------------------|
msgtype | true | 消息类型,此时固定为 image | msgtype | true | 消息类型,此时固定为 image |
base64 | true | 图片内容的 base64 编码 注图片base64 编码前)最大不能超过 2 M支持 JPG、PNG 格式 | base64 | true | 图片内容的 base64 编码 注图片base64 编码前)最大不能超过 2 M支持 JPG、PNG 格式 |
md5 | true | 图片内容base64 编码前)的 md5 值 | 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 ```yaml
- name: WeChat Work notification by news - name: WeChat Work notification by news
@ -85,20 +85,20 @@ md5 | true | 图片内容base64 编码前)的 md5 值
WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}} WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}}
with: with:
msgtype: news 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 | msgtype | true | 消息类型,此时固定为 news |
articles | true | 图文消息,一个图文消息支持 1 到 8 条图文,必须是序列化后的 JSON 字符串 | articles | true | 图文消息,一个图文消息支持 1 到 8 条图文,必须是序列化后的 JSON 字符串 |
articles.title | true | 标题,不超过 128 个字节,超过会自动截断 | articles.title | true | 标题,不超过 128 个字节,超过会自动截断 |
articles.description | false | 描述,不超过 512 个字节,超过会自动截断 | articles.description | false | 描述,不超过 512 个字节,超过会自动截断 |
articles.url | false | 点击后跳转的链接。 | articles.url | false | 点击后跳转的链接。 |
articles.picurl | false | 图文消息的图片链接,支持 JPG、PNG 格式,较好的效果为大图 1068*455小图 150*150。 | 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 ```yaml
- name: WeChat Work notification by file - name: WeChat Work notification by file
@ -110,10 +110,10 @@ articles.picurl | false | 图文消息的图片链接,支持 JPG、PNG 格式
media_id: 3a8asd892asd8asd media_id: 3a8asd892asd8asd
``` ```
参数 | 必须 | 说明 | 参数 | 必须 | 说明 |
------------ | ------------- | ------------- |----------|------|----------------------------------------------------------------------------|
msgtype | true | 消息类型,此时固定为 file | msgtype | true | 消息类型,此时固定为 file |
media_id | true | 文件 id通过 [文件上传接口](https://work.weixin.qq.com/api/doc/90000/90136/91770) 获取 | media_id | true | 文件 id通过 [文件上传接口](https://work.weixin.qq.com/api/doc/90000/90136/91770) 获取 |
### WECHAT_WORK_BOT_WEBHOOK ### WECHAT_WORK_BOT_WEBHOOK

View File

@ -33,5 +33,5 @@ inputs:
required: false required: false
runs: runs:
using: 'node12' using: 'node16'
main: 'dist/index.js' main: 'dist/index.js'

23242
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

View File

Before

Width:  |  Height:  |  Size: 176 KiB

After

Width:  |  Height:  |  Size: 176 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

374
package-lock.json generated
View File

@ -1,101 +1,66 @@
{ {
"name": "action-wechat-work", "name": "action-wechat-work",
"version": "1.0.5", "version": "1.0.7",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "action-wechat-work", "name": "action-wechat-work",
"version": "1.0.5", "version": "1.0.7",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vercel/ncc": "^0.33.1", "axios": "^0.27.1"
"axios": "^0.24.0", },
"lodash": "^4.17.21", "devDependencies": {
"yargs": "^17.3.1" "@vercel/ncc": "^0.33.4"
} }
}, },
"node_modules/@vercel/ncc": { "node_modules/@vercel/ncc": {
"version": "0.33.1", "version": "0.33.4",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.1.tgz", "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.4.tgz",
"integrity": "sha512-Mlsps/P0PLZwsCFtSol23FGqT3FhBGb4B1AuGQ52JTAtXhak+b0Fh/4T55r0/SVQPeRiX9pNItOEHwakGPmZYA==", "integrity": "sha512-ln18hs7dMffelP47tpkaR+V5Tj6coykNyxJrlcmCormPqRQjB/Gv4cu2FfBG+PMzIfdZp2CLDsrrB1NPU22Qhg==",
"dev": true,
"bin": { "bin": {
"ncc": "dist/ncc/cli.js" "ncc": "dist/ncc/cli.js"
} }
}, },
"node_modules/ansi-regex": { "node_modules/asynckit": {
"version": "5.0.1", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
"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": { "node_modules/axios": {
"version": "0.24.0", "version": "0.27.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.1.tgz",
"integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", "integrity": "sha512-ePNMai55xo5GsXajb/k756AqZqpqeDaGwGcdvbZLSSELbbYwsIn2jNmGfUPEwd8j/yu4OoMstLLIVa4t0MneEA==",
"dependencies": { "dependencies": {
"follow-redirects": "^1.14.4" "follow-redirects": "^1.14.9",
"form-data": "^4.0.0"
} }
}, },
"node_modules/cliui": { "node_modules/combined-stream": {
"version": "7.0.4", "version": "1.0.8",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dependencies": { "dependencies": {
"string-width": "^4.2.0", "delayed-stream": "~1.0.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": { "engines": {
"node": ">=7.0.0" "node": ">= 0.8"
} }
}, },
"node_modules/color-name": { "node_modules/delayed-stream": {
"version": "1.1.4", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
},
"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": { "engines": {
"node": ">=6" "node": ">=0.4.0"
} }
}, },
"node_modules/follow-redirects": { "node_modules/follow-redirects": {
"version": "1.14.6", "version": "1.14.9",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz",
"integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==", "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==",
"funding": [ "funding": [
{ {
"type": "individual", "type": "individual",
@ -111,245 +76,100 @@
} }
} }
}, },
"node_modules/get-caller-file": { "node_modules/form-data": {
"version": "2.0.5", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
"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": { "dependencies": {
"emoji-regex": "^8.0.0", "asynckit": "^0.4.0",
"is-fullwidth-code-point": "^3.0.0", "combined-stream": "^1.0.8",
"strip-ansi": "^6.0.1" "mime-types": "^2.1.12"
}, },
"engines": { "engines": {
"node": ">=8" "node": ">= 6"
} }
}, },
"node_modules/strip-ansi": { "node_modules/mime-db": {
"version": "6.0.1", "version": "1.52.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"dependencies": { "dependencies": {
"ansi-regex": "^5.0.1" "mime-db": "1.52.0"
}, },
"engines": { "engines": {
"node": ">=8" "node": ">= 0.6"
}
},
"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": { "dependencies": {
"@vercel/ncc": { "@vercel/ncc": {
"version": "0.33.1", "version": "0.33.4",
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.1.tgz", "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.4.tgz",
"integrity": "sha512-Mlsps/P0PLZwsCFtSol23FGqT3FhBGb4B1AuGQ52JTAtXhak+b0Fh/4T55r0/SVQPeRiX9pNItOEHwakGPmZYA==" "integrity": "sha512-ln18hs7dMffelP47tpkaR+V5Tj6coykNyxJrlcmCormPqRQjB/Gv4cu2FfBG+PMzIfdZp2CLDsrrB1NPU22Qhg==",
"dev": true
}, },
"ansi-regex": { "asynckit": {
"version": "5.0.1", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"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": { "axios": {
"version": "0.24.0", "version": "0.27.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.1.tgz",
"integrity": "sha512-Q6cWsys88HoPgAaFAVUb0WpPk0O8iTeisR9IMqy9G8AbO4NlpVknrnQS03zzF9PGAWgO3cgletO3VjV/P7VztA==", "integrity": "sha512-ePNMai55xo5GsXajb/k756AqZqpqeDaGwGcdvbZLSSELbbYwsIn2jNmGfUPEwd8j/yu4OoMstLLIVa4t0MneEA==",
"requires": { "requires": {
"follow-redirects": "^1.14.4" "follow-redirects": "^1.14.9",
"form-data": "^4.0.0"
} }
}, },
"cliui": { "combined-stream": {
"version": "7.0.4", "version": "1.0.8",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"requires": { "requires": {
"string-width": "^4.2.0", "delayed-stream": "~1.0.0"
"strip-ansi": "^6.0.0",
"wrap-ansi": "^7.0.0"
} }
}, },
"color-convert": { "delayed-stream": {
"version": "2.0.1", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
"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": { "follow-redirects": {
"version": "1.14.6", "version": "1.14.9",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz",
"integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==" "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w=="
}, },
"get-caller-file": { "form-data": {
"version": "2.0.5", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
},
"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": { "requires": {
"emoji-regex": "^8.0.0", "asynckit": "^0.4.0",
"is-fullwidth-code-point": "^3.0.0", "combined-stream": "^1.0.8",
"strip-ansi": "^6.0.1" "mime-types": "^2.1.12"
} }
}, },
"strip-ansi": { "mime-db": {
"version": "6.0.1", "version": "1.52.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="
},
"mime-types": {
"version": "2.1.35",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
"requires": { "requires": {
"ansi-regex": "^5.0.1" "mime-db": "1.52.0"
} }
},
"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", "name": "action-wechat-work",
"version": "1.0.6", "version": "1.0.7",
"description": "GitHub Action that sends a WeChat Work notification.", "description": "GitHub Action that sends a WeChat Work notification.",
"private": true, "private": true,
"scripts": { "scripts": {
"test": "npm test", "test": "npm test",
"build": "ncc build entrypoint.js" "build": "ncc build src/entrypoint.js"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -25,9 +25,9 @@
}, },
"homepage": "https://github.com/chf007/action-wechat-work#readme", "homepage": "https://github.com/chf007/action-wechat-work#readme",
"dependencies": { "dependencies": {
"@vercel/ncc": "^0.33.1", "axios": "^0.27.1"
"axios": "^0.24.0", },
"lodash": "^4.17.21", "devDependencies": {
"yargs": "^17.3.1" "@vercel/ncc": "^0.33.4"
} }
} }

View File

@ -1,6 +1,4 @@
const axios = require('axios'); const axios = require('axios');
const _ = require('lodash');
const { argv } = require('yargs');
const payload = {}; const payload = {};
@ -93,7 +91,8 @@ const url = process.env.WECHAT_WORK_BOT_WEBHOOK;
process.exit(0); process.exit(0);
})() })()
.catch((err) => { .catch((err) => {
console.error(err.message); console.error('Message sent error:');
console.error('Message sent error:', err.response.data); err.message && console.error(err.message);
err.response && err.response.data && console.error(err.response.data);
process.exit(1); process.exit(1);
}); });