diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 801c6a8..181ad5e 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -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"}}'
diff --git a/README.md b/README.md
index 0dc6d57..f261ddc 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@
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"]'
```
@@ -115,6 +115,45 @@
| msgtype | true | 消息类型,此时固定为 file |
| media_id | true | 文件 id,通过 [文件上传接口](https://work.weixin.qq.com/api/doc/90000/90136/91770) 获取 |
+### 模版卡片类型消息 - 文本通知模版卡片
+
+
+
+```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 |
+
+### 模版卡片类型消息 - 图文展示模版卡片
+
+
+
+```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
* **`WECHAT_WORK_BOT_WEBHOOK`**: 企业微信 Webhook URL (**required**)
diff --git a/README.zh-CN.md b/README.zh-CN.md
deleted file mode 100644
index a357b4e..0000000
--- a/README.zh-CN.md
+++ /dev/null
@@ -1,123 +0,0 @@
-# WeChat Work for GitHub Actions
-
-通过企业微信机器人发送消息
-
-
-
-
-
-## 用法
-
-### 纯文本格式消息
-
-
-
-```yaml
-- name: WeChat Work notification by text
- uses: chf007/action-wechat-work@master
- env:
- WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}}
- with:
- msgtype: text
- 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 字符串 |
-
-### Markdown 格式消息
-
-
-
-```yaml
-- name: WeChat Work notification by markdown
- uses: chf007/action-wechat-work@master
- env:
- WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}}
- with:
- msgtype: markdown
- content: "实时新增用户反馈132例,请相关同事注意。\n
- > 类型:用户反馈 \n
- > 普通用户反馈:117例 \n
- > VIP用户反馈:15例"
-```
-
-| 参数 | 必须 | 说明 |
-|---------|------|-----------------------------------------------------------------------------------------------------|
-| msgtype | true | 消息类型,此时固定为 markdown |
-| content | true | markdown 内容,最长不超过 4096 个字节,必须是 utf8 编码 支持的格式详见 https://work.weixin.qq.com/api/doc/90000/90136/91770 |
-
-### 图片格式消息
-
-
-
-```yaml
-- name: WeChat Work notification by image
- uses: chf007/action-wechat-work@master
- env:
- WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}}
- with:
- msgtype: image
- base64: iVBORw0KGgoAAAANSUhEUgAAAPEAAAByCAYAAACC7zd/AAAgAElEQVR4nO19CZRc1Xnm/2qv6lartXa3urUrktDeaiQBJoBBSGxWItszJDEZFMwyoBxPOGPOBBzMsZWB8XDGOMcGA7IVnMMk48nYYBmBJMAOiQwWjdQICe1rJLW6W2tvVV3rm/+7772qV/ur7nqNCt3vqPS6Xt13l//+2733v/cpPb39KklISFQsHJ91BSQkJIYGKcQSEhUOKcQSEhUOKcQSEhUOKcQSEhUOKcQSEhUOKcQSEhUOKcQSEhUOKcQSEhUOV9EUne/Qd35K9NATy6l+16v0wMs7ciSaQKu//RjdUYe/u+jNp7dSwxP3UMOWZ+mN+sfo/oW4v5t+8nQn3YV80p5NpW/mbx38zJMb21M/L7mP1q+Zb0r7DL12OvXzsgefo7s6Mp5pvJPWZZWjA21oW2jKMxvd3d104MA+Cg8MFCBMaVAUhTxeL82adRWNHDmybPlKSBQX4gw0rXqcnlo53nRHF0IW4LZXHqUXWvXbaw1hf5S2m1JvX7tJ/6uFHnleE9xMQDCF4EOBvJX5a+o5CPwbWfXSlEU+dHScoaaGFQXbaFWAnU6nuMbj8Zy/me+rqiryRN5Ll15TNG8JCasoKMRmoXxybRutXtWQI1UntbNlxC/Nax6nR1i6mheON+XxKtGahbTj6c10esJt9NQaSlrkM5z/A2ahZ6u7LlcRadhBL6xNeQPLHtSupzY+Qw9s1G+yJb4rz9NnzrRrlS2ATAE2hBUwC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KiQkAMDQmmRRpYFKsvP8MzSAtLiD3MyFu83IoJiHxBCJQBJsHvIBKsDABrYBXoOOQNAYZlhJChXRAsMBHKR9vAMMgX5SENJvOsehWgB9qPNkHJgemRB7Qy6IN64zs0vGHtccVBC+hoq2uueAY0ghDhCqEyFJOxbRRMCrcdDIrfcR9p8FZLq30DeqFN6Gvkg3obLih+g0KEEgTTQuAg9IZXhfZYLQd9A3qjD0BvYzgAuqDPwYPgBbQBNAOdwBcoF7S1CpQDYUJ+EGDjRXdoH/IxeBB9iL4D8BvugballGPwGugAmsHwNUxospxHIZRlnVhCQqI0wMMo1448eWSthESFQwqxhESFQwqxhESFo6AQO0yBDhISEuWBEcBSLhTMCbN9mHGUgiwhUR5AliBTkK1yoeDsdHWVXyyNBMUJkPa9AV5C4koBLDAEGEtkff1D3yMPFBRiCQmJyx9yYktCosIhhVhCosIhhVhCosIhhVhCosIhhVhCosIhhVhCosIhhVhCosIhhVhCosIhhVhCosLx/wGbobuGmuzo+wAAAABJRU5ErkJggg==
- md5: 0582d8564cdee3187207666898f75205
-```
-
-| 参数 | 必须 | 说明 |
-|---------|------|----------------------------------------------------------|
-| msgtype | true | 消息类型,此时固定为 image |
-| base64 | true | 图片内容的 base64 编码 注:图片(base64 编码前)最大不能超过 2 M,支持 JPG、PNG 格式 |
-| md5 | true | 图片内容(base64 编码前)的 md5 值 |
-
-### 图文格式消息
-
-
-
-```yaml
-- name: WeChat Work notification by news
- uses: chf007/action-wechat-work@master
- env:
- WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}}
- with:
- msgtype: news
- 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。 |
-
-### 文件格式消息
-
-
-
-```yaml
-- name: WeChat Work notification by file
- uses: chf007/action-wechat-work@master
- env:
- WECHAT_WORK_BOT_WEBHOOK: ${{secrets.WECHAT_WORK_BOT_WEBHOOK}}
- with:
- msgtype: file
- media_id: 3a8asd892asd8asd
-```
-
-| 参数 | 必须 | 说明 |
-|----------|------|----------------------------------------------------------------------------|
-| msgtype | true | 消息类型,此时固定为 file |
-| media_id | true | 文件 id,通过 [文件上传接口](https://work.weixin.qq.com/api/doc/90000/90136/91770) 获取 |
-
-### WECHAT_WORK_BOT_WEBHOOK
-
-* **`WECHAT_WORK_BOT_WEBHOOK`**: 企业微信 Webhook URL (**required**)
-* 在 GitHub 仓库的 Settings - Secrets 中设置
-
-### 更多企业微信机器人详细说明,参见 [https://work.weixin.qq.com/api/doc/90000/90136/91770](https://work.weixin.qq.com/api/doc/90000/90136/91770)
diff --git a/action.yml b/action.yml
index e04b53d..0d8b313 100644
--- a/action.yml
+++ b/action.yml
@@ -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,6 +31,9 @@ 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: 'node16'
diff --git a/dist/index.js b/dist/index.js
index 30f7e5d..461236c 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1,20 +1,20 @@
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
-/***/ 4812:
+/***/ 4324:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
module.exports =
{
- parallel : __nccwpck_require__(8210),
- serial : __nccwpck_require__(445),
- serialOrdered : __nccwpck_require__(3578)
+ parallel : __nccwpck_require__(8771),
+ serial : __nccwpck_require__(3218),
+ serialOrdered : __nccwpck_require__(2924)
};
/***/ }),
-/***/ 1700:
+/***/ 3959:
/***/ ((module) => {
// API
@@ -50,10 +50,10 @@ function clean(key)
/***/ }),
-/***/ 2794:
+/***/ 3889:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-var defer = __nccwpck_require__(5295);
+var defer = __nccwpck_require__(7302);
// API
module.exports = async;
@@ -91,7 +91,7 @@ function async(callback)
/***/ }),
-/***/ 5295:
+/***/ 7302:
/***/ ((module) => {
module.exports = defer;
@@ -124,11 +124,11 @@ function defer(fn)
/***/ }),
-/***/ 9023:
+/***/ 1064:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-var async = __nccwpck_require__(2794)
- , abort = __nccwpck_require__(1700)
+var async = __nccwpck_require__(3889)
+ , abort = __nccwpck_require__(3959)
;
// API
@@ -206,7 +206,7 @@ function runJob(iterator, key, item, callback)
/***/ }),
-/***/ 2474:
+/***/ 7135:
/***/ ((module) => {
// API
@@ -250,11 +250,11 @@ function state(list, sortMethod)
/***/ }),
-/***/ 7942:
+/***/ 8534:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-var abort = __nccwpck_require__(1700)
- , async = __nccwpck_require__(2794)
+var abort = __nccwpck_require__(3959)
+ , async = __nccwpck_require__(3889)
;
// API
@@ -286,12 +286,12 @@ function terminator(callback)
/***/ }),
-/***/ 8210:
+/***/ 8771:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-var iterate = __nccwpck_require__(9023)
- , initState = __nccwpck_require__(2474)
- , terminator = __nccwpck_require__(7942)
+var iterate = __nccwpck_require__(1064)
+ , initState = __nccwpck_require__(7135)
+ , terminator = __nccwpck_require__(8534)
;
// Public API
@@ -336,10 +336,10 @@ function parallel(list, iterator, callback)
/***/ }),
-/***/ 445:
+/***/ 3218:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-var serialOrdered = __nccwpck_require__(3578);
+var serialOrdered = __nccwpck_require__(2924);
// Public API
module.exports = serial;
@@ -360,12 +360,12 @@ function serial(list, iterator, callback)
/***/ }),
-/***/ 3578:
+/***/ 2924:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-var iterate = __nccwpck_require__(9023)
- , initState = __nccwpck_require__(2474)
- , terminator = __nccwpck_require__(7942)
+var iterate = __nccwpck_require__(1064)
+ , initState = __nccwpck_require__(7135)
+ , terminator = __nccwpck_require__(8534)
;
// Public API
@@ -442,33 +442,33 @@ function descending(a, b)
/***/ }),
-/***/ 6545:
+/***/ 8734:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-module.exports = __nccwpck_require__(2618);
+module.exports = __nccwpck_require__(5202);
/***/ }),
-/***/ 8104:
+/***/ 5610:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var utils = __nccwpck_require__(328);
-var settle = __nccwpck_require__(3211);
-var buildFullPath = __nccwpck_require__(1934);
-var buildURL = __nccwpck_require__(646);
+var utils = __nccwpck_require__(5226);
+var settle = __nccwpck_require__(3734);
+var buildFullPath = __nccwpck_require__(4242);
+var buildURL = __nccwpck_require__(8054);
var http = __nccwpck_require__(3685);
var https = __nccwpck_require__(5687);
-var httpFollow = (__nccwpck_require__(7707).http);
-var httpsFollow = (__nccwpck_require__(7707).https);
+var httpFollow = (__nccwpck_require__(3293).http);
+var httpsFollow = (__nccwpck_require__(3293).https);
var url = __nccwpck_require__(7310);
var zlib = __nccwpck_require__(9796);
-var VERSION = (__nccwpck_require__(4322).version);
-var transitionalDefaults = __nccwpck_require__(936);
-var AxiosError = __nccwpck_require__(2093);
-var CanceledError = __nccwpck_require__(4098);
+var VERSION = (__nccwpck_require__(8719).version);
+var transitionalDefaults = __nccwpck_require__(8605);
+var AxiosError = __nccwpck_require__(532);
+var CanceledError = __nccwpck_require__(8317);
var isHttps = /https:?/;
@@ -881,22 +881,23 @@ module.exports = function httpAdapter(config) {
/***/ }),
-/***/ 3454:
+/***/ 4377:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var utils = __nccwpck_require__(328);
-var settle = __nccwpck_require__(3211);
-var cookies = __nccwpck_require__(1545);
-var buildURL = __nccwpck_require__(646);
-var buildFullPath = __nccwpck_require__(1934);
-var parseHeaders = __nccwpck_require__(6455);
-var isURLSameOrigin = __nccwpck_require__(3608);
-var transitionalDefaults = __nccwpck_require__(936);
-var AxiosError = __nccwpck_require__(2093);
-var CanceledError = __nccwpck_require__(4098);
+var utils = __nccwpck_require__(5226);
+var settle = __nccwpck_require__(3734);
+var cookies = __nccwpck_require__(1149);
+var buildURL = __nccwpck_require__(8054);
+var buildFullPath = __nccwpck_require__(4242);
+var parseHeaders = __nccwpck_require__(9908);
+var isURLSameOrigin = __nccwpck_require__(2318);
+var transitionalDefaults = __nccwpck_require__(8605);
+var AxiosError = __nccwpck_require__(532);
+var CanceledError = __nccwpck_require__(8317);
+var parseProtocol = __nccwpck_require__(8469);
module.exports = function xhrAdapter(config) {
return new Promise(function dispatchXhrRequest(resolve, reject) {
@@ -914,6 +915,10 @@ module.exports = function xhrAdapter(config) {
}
}
+ if (utils.isFormData(requestData) && utils.isStandardBrowserEnv()) {
+ delete requestHeaders['Content-Type']; // Let the browser set it
+ }
+
var request = new XMLHttpRequest();
// HTTP basic authentication
@@ -1090,8 +1095,7 @@ module.exports = function xhrAdapter(config) {
requestData = null;
}
- var tokens = fullPath.split(':', 2);
- var protocol = tokens.length > 1 && tokens[0];
+ var protocol = parseProtocol(fullPath);
if (protocol && [ 'http', 'https', 'file' ].indexOf(protocol) === -1) {
reject(new AxiosError('Unsupported protocol ' + protocol + ':', AxiosError.ERR_BAD_REQUEST, config));
@@ -1107,17 +1111,17 @@ module.exports = function xhrAdapter(config) {
/***/ }),
-/***/ 2618:
+/***/ 5202:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var utils = __nccwpck_require__(328);
-var bind = __nccwpck_require__(7065);
-var Axios = __nccwpck_require__(8178);
-var mergeConfig = __nccwpck_require__(4831);
-var defaults = __nccwpck_require__(1626);
+var utils = __nccwpck_require__(5226);
+var bind = __nccwpck_require__(1510);
+var Axios = __nccwpck_require__(1024);
+var mergeConfig = __nccwpck_require__(2354);
+var defaults = __nccwpck_require__(8987);
/**
* Create an instance of Axios
@@ -1150,14 +1154,14 @@ var axios = createInstance(defaults);
axios.Axios = Axios;
// Expose Cancel & CancelToken
-axios.CanceledError = __nccwpck_require__(4098);
-axios.CancelToken = __nccwpck_require__(1587);
-axios.isCancel = __nccwpck_require__(4057);
-axios.VERSION = (__nccwpck_require__(4322).version);
-axios.toFormData = __nccwpck_require__(470);
+axios.CanceledError = __nccwpck_require__(8317);
+axios.CancelToken = __nccwpck_require__(8114);
+axios.isCancel = __nccwpck_require__(227);
+axios.VERSION = (__nccwpck_require__(8719).version);
+axios.toFormData = __nccwpck_require__(3754);
// Expose AxiosError class
-axios.AxiosError = __nccwpck_require__(2093);
+axios.AxiosError = __nccwpck_require__(532);
// alias for CanceledError for backward compatibility
axios.Cancel = axios.CanceledError;
@@ -1166,10 +1170,10 @@ axios.Cancel = axios.CanceledError;
axios.all = function all(promises) {
return Promise.all(promises);
};
-axios.spread = __nccwpck_require__(4850);
+axios.spread = __nccwpck_require__(9335);
// Expose isAxiosError
-axios.isAxiosError = __nccwpck_require__(650);
+axios.isAxiosError = __nccwpck_require__(2518);
module.exports = axios;
@@ -1179,13 +1183,13 @@ module.exports["default"] = axios;
/***/ }),
-/***/ 1587:
+/***/ 8114:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var CanceledError = __nccwpck_require__(4098);
+var CanceledError = __nccwpck_require__(8317);
/**
* A `CancelToken` is an object that can be used to request cancellation of an operation.
@@ -1306,14 +1310,14 @@ module.exports = CancelToken;
/***/ }),
-/***/ 4098:
+/***/ 8317:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var AxiosError = __nccwpck_require__(2093);
-var utils = __nccwpck_require__(328);
+var AxiosError = __nccwpck_require__(532);
+var utils = __nccwpck_require__(5226);
/**
* A `CanceledError` is an object that is thrown when an operation is canceled.
@@ -1336,7 +1340,7 @@ module.exports = CanceledError;
/***/ }),
-/***/ 4057:
+/***/ 227:
/***/ ((module) => {
"use strict";
@@ -1349,19 +1353,19 @@ module.exports = function isCancel(value) {
/***/ }),
-/***/ 8178:
+/***/ 1024:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var utils = __nccwpck_require__(328);
-var buildURL = __nccwpck_require__(646);
-var InterceptorManager = __nccwpck_require__(3214);
-var dispatchRequest = __nccwpck_require__(5062);
-var mergeConfig = __nccwpck_require__(4831);
-var buildFullPath = __nccwpck_require__(1934);
-var validator = __nccwpck_require__(1632);
+var utils = __nccwpck_require__(5226);
+var buildURL = __nccwpck_require__(8054);
+var InterceptorManager = __nccwpck_require__(4351);
+var dispatchRequest = __nccwpck_require__(518);
+var mergeConfig = __nccwpck_require__(2354);
+var buildFullPath = __nccwpck_require__(4242);
+var validator = __nccwpck_require__(2866);
var validators = validator.validators;
/**
@@ -1517,13 +1521,13 @@ module.exports = Axios;
/***/ }),
-/***/ 2093:
+/***/ 532:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var utils = __nccwpck_require__(328);
+var utils = __nccwpck_require__(5226);
/**
* Create an Error with the specified message, config, error code, request and response.
@@ -1611,13 +1615,13 @@ module.exports = AxiosError;
/***/ }),
-/***/ 3214:
+/***/ 4351:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var utils = __nccwpck_require__(328);
+var utils = __nccwpck_require__(5226);
function InterceptorManager() {
this.handlers = [];
@@ -1673,14 +1677,14 @@ module.exports = InterceptorManager;
/***/ }),
-/***/ 1934:
+/***/ 4242:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var isAbsoluteURL = __nccwpck_require__(1301);
-var combineURLs = __nccwpck_require__(7189);
+var isAbsoluteURL = __nccwpck_require__(3527);
+var combineURLs = __nccwpck_require__(1555);
/**
* Creates a new URL by combining the baseURL with the requestedURL,
@@ -1701,17 +1705,17 @@ module.exports = function buildFullPath(baseURL, requestedURL) {
/***/ }),
-/***/ 5062:
+/***/ 518:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var utils = __nccwpck_require__(328);
-var transformData = __nccwpck_require__(9812);
-var isCancel = __nccwpck_require__(4057);
-var defaults = __nccwpck_require__(1626);
-var CanceledError = __nccwpck_require__(4098);
+var utils = __nccwpck_require__(5226);
+var transformData = __nccwpck_require__(6539);
+var isCancel = __nccwpck_require__(227);
+var defaults = __nccwpck_require__(8987);
+var CanceledError = __nccwpck_require__(8317);
/**
* Throws a `CanceledError` if cancellation has been requested.
@@ -1796,13 +1800,13 @@ module.exports = function dispatchRequest(config) {
/***/ }),
-/***/ 4831:
+/***/ 2354:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var utils = __nccwpck_require__(328);
+var utils = __nccwpck_require__(5226);
/**
* Config-specific merge-function which creates a new config-object
@@ -1904,13 +1908,13 @@ module.exports = function mergeConfig(config1, config2) {
/***/ }),
-/***/ 3211:
+/***/ 3734:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var AxiosError = __nccwpck_require__(2093);
+var AxiosError = __nccwpck_require__(532);
/**
* Resolve or reject a Promise based on response status.
@@ -1937,14 +1941,14 @@ module.exports = function settle(resolve, reject, response) {
/***/ }),
-/***/ 9812:
+/***/ 6539:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var utils = __nccwpck_require__(328);
-var defaults = __nccwpck_require__(1626);
+var utils = __nccwpck_require__(5226);
+var defaults = __nccwpck_require__(8987);
/**
* Transform the data for a request or a response
@@ -1967,26 +1971,26 @@ module.exports = function transformData(data, headers, fns) {
/***/ }),
-/***/ 7024:
+/***/ 5722:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
// eslint-disable-next-line strict
-module.exports = __nccwpck_require__(4334);
+module.exports = __nccwpck_require__(9834);
/***/ }),
-/***/ 1626:
+/***/ 8987:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var utils = __nccwpck_require__(328);
-var normalizeHeaderName = __nccwpck_require__(6240);
-var AxiosError = __nccwpck_require__(2093);
-var transitionalDefaults = __nccwpck_require__(936);
-var toFormData = __nccwpck_require__(470);
+var utils = __nccwpck_require__(5226);
+var normalizeHeaderName = __nccwpck_require__(5695);
+var AxiosError = __nccwpck_require__(532);
+var transitionalDefaults = __nccwpck_require__(8605);
+var toFormData = __nccwpck_require__(3754);
var DEFAULT_CONTENT_TYPE = {
'Content-Type': 'application/x-www-form-urlencoded'
@@ -2002,10 +2006,10 @@ function getDefaultAdapter() {
var adapter;
if (typeof XMLHttpRequest !== 'undefined') {
// For browsers use XHR adapter
- adapter = __nccwpck_require__(3454);
+ adapter = __nccwpck_require__(4377);
} else if (typeof process !== 'undefined' && Object.prototype.toString.call(process) === '[object process]') {
// For node use HTTP adapter
- adapter = __nccwpck_require__(8104);
+ adapter = __nccwpck_require__(5610);
}
return adapter;
}
@@ -2103,7 +2107,7 @@ var defaults = {
maxBodyLength: -1,
env: {
- FormData: __nccwpck_require__(7024)
+ FormData: __nccwpck_require__(5722)
},
validateStatus: function validateStatus(status) {
@@ -2130,7 +2134,7 @@ module.exports = defaults;
/***/ }),
-/***/ 936:
+/***/ 8605:
/***/ ((module) => {
"use strict";
@@ -2145,16 +2149,16 @@ module.exports = {
/***/ }),
-/***/ 4322:
+/***/ 8719:
/***/ ((module) => {
module.exports = {
- "version": "0.27.1"
+ "version": "0.27.2"
};
/***/ }),
-/***/ 7065:
+/***/ 1510:
/***/ ((module) => {
"use strict";
@@ -2173,13 +2177,13 @@ module.exports = function bind(fn, thisArg) {
/***/ }),
-/***/ 646:
+/***/ 8054:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var utils = __nccwpck_require__(328);
+var utils = __nccwpck_require__(5226);
function encode(val) {
return encodeURIComponent(val).
@@ -2251,7 +2255,7 @@ module.exports = function buildURL(url, params, paramsSerializer) {
/***/ }),
-/***/ 7189:
+/***/ 1555:
/***/ ((module) => {
"use strict";
@@ -2273,13 +2277,13 @@ module.exports = function combineURLs(baseURL, relativeURL) {
/***/ }),
-/***/ 1545:
+/***/ 1149:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var utils = __nccwpck_require__(328);
+var utils = __nccwpck_require__(5226);
module.exports = (
utils.isStandardBrowserEnv() ?
@@ -2334,7 +2338,7 @@ module.exports = (
/***/ }),
-/***/ 1301:
+/***/ 3527:
/***/ ((module) => {
"use strict";
@@ -2356,13 +2360,13 @@ module.exports = function isAbsoluteURL(url) {
/***/ }),
-/***/ 650:
+/***/ 2518:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var utils = __nccwpck_require__(328);
+var utils = __nccwpck_require__(5226);
/**
* Determines whether the payload is an error thrown by Axios
@@ -2377,13 +2381,13 @@ module.exports = function isAxiosError(payload) {
/***/ }),
-/***/ 3608:
+/***/ 2318:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var utils = __nccwpck_require__(328);
+var utils = __nccwpck_require__(5226);
module.exports = (
utils.isStandardBrowserEnv() ?
@@ -2453,13 +2457,13 @@ module.exports = (
/***/ }),
-/***/ 6240:
+/***/ 5695:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var utils = __nccwpck_require__(328);
+var utils = __nccwpck_require__(5226);
module.exports = function normalizeHeaderName(headers, normalizedName) {
utils.forEach(headers, function processHeader(value, name) {
@@ -2473,13 +2477,13 @@ module.exports = function normalizeHeaderName(headers, normalizedName) {
/***/ }),
-/***/ 6455:
+/***/ 9908:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var utils = __nccwpck_require__(328);
+var utils = __nccwpck_require__(5226);
// Headers whose duplicates are ignored by node
// c.f. https://nodejs.org/api/http.html#http_message_headers
@@ -2534,7 +2538,21 @@ module.exports = function parseHeaders(headers) {
/***/ }),
-/***/ 4850:
+/***/ 8469:
+/***/ ((module) => {
+
+"use strict";
+
+
+module.exports = function parseProtocol(url) {
+ var match = /^([-+\w]{1,25})(:?\/\/|:)/.exec(url);
+ return match && match[1] || '';
+};
+
+
+/***/ }),
+
+/***/ 9335:
/***/ ((module) => {
"use strict";
@@ -2569,13 +2587,13 @@ module.exports = function spread(callback) {
/***/ }),
-/***/ 470:
+/***/ 3754:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var utils = __nccwpck_require__(328);
+var utils = __nccwpck_require__(5226);
/**
* Convert a data object to FormData
@@ -2649,14 +2667,14 @@ module.exports = toFormData;
/***/ }),
-/***/ 1632:
+/***/ 2866:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var VERSION = (__nccwpck_require__(4322).version);
-var AxiosError = __nccwpck_require__(2093);
+var VERSION = (__nccwpck_require__(8719).version);
+var AxiosError = __nccwpck_require__(532);
var validators = {};
@@ -2743,13 +2761,13 @@ module.exports = {
/***/ }),
-/***/ 328:
+/***/ 5226:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
"use strict";
-var bind = __nccwpck_require__(7065);
+var bind = __nccwpck_require__(1510);
// utils is a library of generic helper functions non-specific to axios
@@ -3221,12 +3239,12 @@ module.exports = {
/***/ }),
-/***/ 5443:
+/***/ 9987:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
var util = __nccwpck_require__(3837);
var Stream = (__nccwpck_require__(2781).Stream);
-var DelayedStream = __nccwpck_require__(8611);
+var DelayedStream = __nccwpck_require__(249);
module.exports = CombinedStream;
function CombinedStream() {
@@ -3436,7 +3454,7 @@ CombinedStream.prototype._emitError = function(err) {
/***/ }),
-/***/ 8611:
+/***/ 249:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
var Stream = (__nccwpck_require__(2781).Stream);
@@ -3550,7 +3568,7 @@ DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() {
/***/ }),
-/***/ 1133:
+/***/ 8036:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
var debug;
@@ -3559,7 +3577,7 @@ module.exports = function () {
if (!debug) {
try {
/* eslint global-require: off */
- debug = __nccwpck_require__(9975)("follow-redirects");
+ debug = __nccwpck_require__(7143)("follow-redirects");
}
catch (error) { /* */ }
if (typeof debug !== "function") {
@@ -3572,7 +3590,7 @@ module.exports = function () {
/***/ }),
-/***/ 7707:
+/***/ 3293:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
var url = __nccwpck_require__(7310);
@@ -3581,7 +3599,7 @@ var http = __nccwpck_require__(3685);
var https = __nccwpck_require__(5687);
var Writable = (__nccwpck_require__(2781).Writable);
var assert = __nccwpck_require__(9491);
-var debug = __nccwpck_require__(1133);
+var debug = __nccwpck_require__(8036);
// Create handlers that pass events from native requests
var events = ["abort", "aborted", "connect", "error", "socket", "timeout"];
@@ -3592,6 +3610,11 @@ events.forEach(function (event) {
};
});
+var InvalidUrlError = createErrorType(
+ "ERR_INVALID_URL",
+ "Invalid URL",
+ TypeError
+);
// Error types with codes
var RedirectionError = createErrorType(
"ERR_FR_REDIRECTION_FAILURE",
@@ -3652,10 +3675,10 @@ RedirectableRequest.prototype.write = function (data, encoding, callback) {
}
// Validate input and shift parameters if necessary
- if (!(typeof data === "string" || typeof data === "object" && ("length" in data))) {
+ if (!isString(data) && !isBuffer(data)) {
throw new TypeError("data should be a string, Buffer or Uint8Array");
}
- if (typeof encoding === "function") {
+ if (isFunction(encoding)) {
callback = encoding;
encoding = null;
}
@@ -3684,11 +3707,11 @@ RedirectableRequest.prototype.write = function (data, encoding, callback) {
// Ends the current native request
RedirectableRequest.prototype.end = function (data, encoding, callback) {
// Shift parameters if necessary
- if (typeof data === "function") {
+ if (isFunction(data)) {
callback = data;
data = encoding = null;
}
- else if (typeof encoding === "function") {
+ else if (isFunction(encoding)) {
callback = encoding;
encoding = null;
}
@@ -3847,25 +3870,30 @@ RedirectableRequest.prototype._performRequest = function () {
// If specified, use the agent corresponding to the protocol
// (HTTP and HTTPS use different types of agents)
if (this._options.agents) {
- var scheme = protocol.substr(0, protocol.length - 1);
+ var scheme = protocol.slice(0, -1);
this._options.agent = this._options.agents[scheme];
}
- // Create the native request
+ // Create the native request and set up its event handlers
var request = this._currentRequest =
nativeProtocol.request(this._options, this._onNativeResponse);
- this._currentUrl = url.format(this._options);
-
- // Set up event handlers
request._redirectable = this;
- for (var e = 0; e < events.length; e++) {
- request.on(events[e], eventHandlers[events[e]]);
+ for (var event of events) {
+ request.on(event, eventHandlers[event]);
}
+ // RFC7230§5.3.1: When making a request directly to an origin server, […]
+ // a client MUST send only the absolute path […] as the request-target.
+ this._currentUrl = /^\//.test(this._options.path) ?
+ url.format(this._options) :
+ // When making a request to a proxy, […]
+ // a client MUST send the target URI in absolute-form […].
+ this._options.path;
+
// End a redirected request
// (The first request must be ended explicitly with RedirectableRequest#end)
if (this._isRedirect) {
- // Write the request entity and end.
+ // Write the request entity and end
var i = 0;
var self = this;
var buffers = this._requestBodyBuffers;
@@ -3939,10 +3967,21 @@ RedirectableRequest.prototype._processResponse = function (response) {
return;
}
+ // Store the request headers if applicable
+ var requestHeaders;
+ var beforeRedirect = this._options.beforeRedirect;
+ if (beforeRedirect) {
+ requestHeaders = Object.assign({
+ // The Host header was set by nativeProtocol.request
+ Host: response.req.getHeader("host"),
+ }, this._options.headers);
+ }
+
// RFC7231§6.4: Automatic redirection needs to done with
// care for methods not known to be safe, […]
// RFC7231§6.4.2–3: For historical reasons, a user agent MAY change
// the request method from POST to GET for the subsequent request.
+ var method = this._options.method;
if ((statusCode === 301 || statusCode === 302) && this._options.method === "POST" ||
// RFC7231§6.4.4: The 303 (See Other) status code indicates that
// the server is redirecting the user agent to a different resource […]
@@ -3970,7 +4009,7 @@ RedirectableRequest.prototype._processResponse = function (response) {
redirectUrl = url.resolve(currentUrl, location);
}
catch (cause) {
- this.emit("error", new RedirectionError(cause));
+ this.emit("error", new RedirectionError({ cause: cause }));
return;
}
@@ -3990,10 +4029,18 @@ RedirectableRequest.prototype._processResponse = function (response) {
}
// Evaluate the beforeRedirect callback
- if (typeof this._options.beforeRedirect === "function") {
- var responseDetails = { headers: response.headers };
+ if (isFunction(beforeRedirect)) {
+ var responseDetails = {
+ headers: response.headers,
+ statusCode: statusCode,
+ };
+ var requestDetails = {
+ url: currentUrl,
+ method: method,
+ headers: requestHeaders,
+ };
try {
- this._options.beforeRedirect.call(null, this._options, responseDetails);
+ beforeRedirect(this._options, responseDetails, requestDetails);
}
catch (err) {
this.emit("error", err);
@@ -4007,7 +4054,7 @@ RedirectableRequest.prototype._processResponse = function (response) {
this._performRequest();
}
catch (cause) {
- this.emit("error", new RedirectionError(cause));
+ this.emit("error", new RedirectionError({ cause: cause }));
}
};
@@ -4029,15 +4076,19 @@ function wrap(protocols) {
// Executes a request, following redirects
function request(input, options, callback) {
// Parse parameters
- if (typeof input === "string") {
- var urlStr = input;
+ if (isString(input)) {
+ var parsed;
try {
- input = urlToOptions(new URL(urlStr));
+ parsed = urlToOptions(new URL(input));
}
catch (err) {
/* istanbul ignore next */
- input = url.parse(urlStr);
+ parsed = url.parse(input);
}
+ if (!isString(parsed.protocol)) {
+ throw new InvalidUrlError({ input });
+ }
+ input = parsed;
}
else if (URL && (input instanceof URL)) {
input = urlToOptions(input);
@@ -4047,7 +4098,7 @@ function wrap(protocols) {
options = input;
input = { protocol: protocol };
}
- if (typeof options === "function") {
+ if (isFunction(options)) {
callback = options;
options = null;
}
@@ -4058,6 +4109,9 @@ function wrap(protocols) {
maxBodyLength: exports.maxBodyLength,
}, input, options);
options.nativeProtocols = nativeProtocols;
+ if (!isString(options.host) && !isString(options.hostname)) {
+ options.hostname = "::1";
+ }
assert.equal(options.protocol, protocol, "protocol mismatch");
debug("options", options);
@@ -4115,37 +4169,48 @@ function removeMatchingHeaders(regex, headers) {
undefined : String(lastValue).trim();
}
-function createErrorType(code, defaultMessage) {
- function CustomError(cause) {
+function createErrorType(code, message, baseClass) {
+ // Create constructor
+ function CustomError(properties) {
Error.captureStackTrace(this, this.constructor);
- if (!cause) {
- this.message = defaultMessage;
- }
- else {
- this.message = defaultMessage + ": " + cause.message;
- this.cause = cause;
- }
+ Object.assign(this, properties || {});
+ this.code = code;
+ this.message = this.cause ? message + ": " + this.cause.message : message;
}
- CustomError.prototype = new Error();
+
+ // Attach constructor and set default properties
+ CustomError.prototype = new (baseClass || Error)();
CustomError.prototype.constructor = CustomError;
CustomError.prototype.name = "Error [" + code + "]";
- CustomError.prototype.code = code;
return CustomError;
}
function abortRequest(request) {
- for (var e = 0; e < events.length; e++) {
- request.removeListener(events[e], eventHandlers[events[e]]);
+ for (var event of events) {
+ request.removeListener(event, eventHandlers[event]);
}
request.on("error", noop);
request.abort();
}
function isSubdomain(subdomain, domain) {
- const dot = subdomain.length - domain.length - 1;
+ assert(isString(subdomain) && isString(domain));
+ var dot = subdomain.length - domain.length - 1;
return dot > 0 && subdomain[dot] === "." && subdomain.endsWith(domain);
}
+function isString(value) {
+ return typeof value === "string" || value instanceof String;
+}
+
+function isFunction(value) {
+ return typeof value === "function";
+}
+
+function isBuffer(value) {
+ return typeof value === "object" && ("length" in value);
+}
+
// Exports
module.exports = wrap({ http: http, https: https });
module.exports.wrap = wrap;
@@ -4153,10 +4218,10 @@ module.exports.wrap = wrap;
/***/ }),
-/***/ 4334:
+/***/ 9834:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
-var CombinedStream = __nccwpck_require__(5443);
+var CombinedStream = __nccwpck_require__(9987);
var util = __nccwpck_require__(3837);
var path = __nccwpck_require__(1017);
var http = __nccwpck_require__(3685);
@@ -4164,9 +4229,9 @@ var https = __nccwpck_require__(5687);
var parseUrl = (__nccwpck_require__(7310).parse);
var fs = __nccwpck_require__(7147);
var Stream = (__nccwpck_require__(2781).Stream);
-var mime = __nccwpck_require__(3583);
-var asynckit = __nccwpck_require__(4812);
-var populate = __nccwpck_require__(7142);
+var mime = __nccwpck_require__(2075);
+var asynckit = __nccwpck_require__(4324);
+var populate = __nccwpck_require__(1513);
// Public API
module.exports = FormData;
@@ -4661,7 +4726,7 @@ FormData.prototype.toString = function () {
/***/ }),
-/***/ 7142:
+/***/ 1513:
/***/ ((module) => {
// populates missing values
@@ -4678,7 +4743,7 @@ module.exports = function(dst, src) {
/***/ }),
-/***/ 7426:
+/***/ 7165:
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
/*!
@@ -4692,12 +4757,12 @@ module.exports = function(dst, src) {
* Module exports.
*/
-module.exports = __nccwpck_require__(3765)
+module.exports = __nccwpck_require__(4558)
/***/ }),
-/***/ 3583:
+/***/ 2075:
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
"use strict";
@@ -4715,7 +4780,7 @@ module.exports = __nccwpck_require__(3765)
* @private
*/
-var db = __nccwpck_require__(7426)
+var db = __nccwpck_require__(7165)
var extname = (__nccwpck_require__(1017).extname)
/**
@@ -4893,7 +4958,7 @@ function populateMaps (extensions, types) {
/***/ }),
-/***/ 9975:
+/***/ 7143:
/***/ ((module) => {
module.exports = eval("require")("debug");
@@ -4973,7 +5038,7 @@ module.exports = require("zlib");
/***/ }),
-/***/ 3765:
+/***/ 4558:
/***/ ((module) => {
"use strict";
@@ -5022,13 +5087,18 @@ module.exports = JSON.parse('{"application/1d-interleaved-parityfec":{"source":"
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
-const axios = __nccwpck_require__(6545);
+const axios = __nccwpck_require__(8734);
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,
};
@@ -5039,6 +5109,7 @@ if (process.env.INPUT_MSGTYPE === 'text') {
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;
}
@@ -5049,6 +5120,7 @@ if (process.env.INPUT_MSGTYPE === 'text') {
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;
}
@@ -5058,6 +5130,11 @@ if (process.env.INPUT_MSGTYPE === 'text') {
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,
};
@@ -5067,6 +5144,15 @@ if (process.env.INPUT_MSGTYPE === 'markdown') {
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,
@@ -5083,6 +5169,7 @@ if (process.env.INPUT_MSGTYPE === 'news') {
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,
@@ -5093,31 +5180,50 @@ if (process.env.INPUT_MSGTYPE === 'news') {
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,
};
}
-console.log('The message content in JSON format...');
-console.log(JSON.stringify(payload));
+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('Sending message ...');
+ console.log('[action-wechat-work] Sending message ...');
await axios.post(url, JSON.stringify(payload), {
headers: {
'Content-Type': 'application/json'
},
});
- console.log('Message sent Success! Shutting down ...');
+ console.log('[action-wechat-work] Message sent Success! Shutting down ...');
process.exit(0);
})()
.catch((err) => {
- console.error('Message sent error:');
- err.message && console.error(err.message);
- err.response && err.response.data && console.error(err.response.data);
+ 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);
});
diff --git a/docs/wechat-work-msg-news-notice.webp b/docs/wechat-work-msg-news-notice.webp
new file mode 100644
index 0000000..c6cf897
Binary files /dev/null and b/docs/wechat-work-msg-news-notice.webp differ
diff --git a/docs/wechat-work-msg-text-notice.webp b/docs/wechat-work-msg-text-notice.webp
new file mode 100644
index 0000000..9f1dcdb
Binary files /dev/null and b/docs/wechat-work-msg-text-notice.webp differ
diff --git a/package-lock.json b/package-lock.json
deleted file mode 100644
index d75d07e..0000000
--- a/package-lock.json
+++ /dev/null
@@ -1,175 +0,0 @@
-{
- "name": "action-wechat-work",
- "version": "1.0.7",
- "lockfileVersion": 2,
- "requires": true,
- "packages": {
- "": {
- "name": "action-wechat-work",
- "version": "1.0.7",
- "license": "MIT",
- "dependencies": {
- "axios": "^0.27.1"
- },
- "devDependencies": {
- "@vercel/ncc": "^0.33.4"
- }
- },
- "node_modules/@vercel/ncc": {
- "version": "0.33.4",
- "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.4.tgz",
- "integrity": "sha512-ln18hs7dMffelP47tpkaR+V5Tj6coykNyxJrlcmCormPqRQjB/Gv4cu2FfBG+PMzIfdZp2CLDsrrB1NPU22Qhg==",
- "dev": true,
- "bin": {
- "ncc": "dist/ncc/cli.js"
- }
- },
- "node_modules/asynckit": {
- "version": "0.4.0",
- "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
- "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
- },
- "node_modules/axios": {
- "version": "0.27.1",
- "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.1.tgz",
- "integrity": "sha512-ePNMai55xo5GsXajb/k756AqZqpqeDaGwGcdvbZLSSELbbYwsIn2jNmGfUPEwd8j/yu4OoMstLLIVa4t0MneEA==",
- "dependencies": {
- "follow-redirects": "^1.14.9",
- "form-data": "^4.0.0"
- }
- },
- "node_modules/combined-stream": {
- "version": "1.0.8",
- "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
- "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
- "dependencies": {
- "delayed-stream": "~1.0.0"
- },
- "engines": {
- "node": ">= 0.8"
- }
- },
- "node_modules/delayed-stream": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
- "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
- "engines": {
- "node": ">=0.4.0"
- }
- },
- "node_modules/follow-redirects": {
- "version": "1.14.9",
- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz",
- "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==",
- "funding": [
- {
- "type": "individual",
- "url": "https://github.com/sponsors/RubenVerborgh"
- }
- ],
- "engines": {
- "node": ">=4.0"
- },
- "peerDependenciesMeta": {
- "debug": {
- "optional": true
- }
- }
- },
- "node_modules/form-data": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
- "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
- "dependencies": {
- "asynckit": "^0.4.0",
- "combined-stream": "^1.0.8",
- "mime-types": "^2.1.12"
- },
- "engines": {
- "node": ">= 6"
- }
- },
- "node_modules/mime-db": {
- "version": "1.52.0",
- "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
- "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": {
- "mime-db": "1.52.0"
- },
- "engines": {
- "node": ">= 0.6"
- }
- }
- },
- "dependencies": {
- "@vercel/ncc": {
- "version": "0.33.4",
- "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.33.4.tgz",
- "integrity": "sha512-ln18hs7dMffelP47tpkaR+V5Tj6coykNyxJrlcmCormPqRQjB/Gv4cu2FfBG+PMzIfdZp2CLDsrrB1NPU22Qhg==",
- "dev": true
- },
- "asynckit": {
- "version": "0.4.0",
- "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
- "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
- },
- "axios": {
- "version": "0.27.1",
- "resolved": "https://registry.npmjs.org/axios/-/axios-0.27.1.tgz",
- "integrity": "sha512-ePNMai55xo5GsXajb/k756AqZqpqeDaGwGcdvbZLSSELbbYwsIn2jNmGfUPEwd8j/yu4OoMstLLIVa4t0MneEA==",
- "requires": {
- "follow-redirects": "^1.14.9",
- "form-data": "^4.0.0"
- }
- },
- "combined-stream": {
- "version": "1.0.8",
- "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
- "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
- "requires": {
- "delayed-stream": "~1.0.0"
- }
- },
- "delayed-stream": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
- "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
- },
- "follow-redirects": {
- "version": "1.14.9",
- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz",
- "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w=="
- },
- "form-data": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
- "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
- "requires": {
- "asynckit": "^0.4.0",
- "combined-stream": "^1.0.8",
- "mime-types": "^2.1.12"
- }
- },
- "mime-db": {
- "version": "1.52.0",
- "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
- "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": {
- "mime-db": "1.52.0"
- }
- }
- }
-}
diff --git a/package.json b/package.json
index e71594c..0969ba8 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "action-wechat-work",
- "version": "1.0.7",
+ "version": "1.0.8",
"description": "GitHub Action that sends a WeChat Work notification.",
"private": true,
"scripts": {
@@ -25,9 +25,9 @@
},
"homepage": "https://github.com/chf007/action-wechat-work#readme",
"dependencies": {
- "axios": "^0.27.1"
+ "axios": "^0.27.2"
},
"devDependencies": {
- "@vercel/ncc": "^0.33.4"
+ "@vercel/ncc": "^0.34.0"
}
}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
new file mode 100644
index 0000000..9252657
--- /dev/null
+++ b/pnpm-lock.yaml
@@ -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
diff --git a/src/entrypoint.js b/src/entrypoint.js
index 16fa913..3c1c56e 100644
--- a/src/entrypoint.js
+++ b/src/entrypoint.js
@@ -5,6 +5,11 @@ 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,
};
@@ -15,6 +20,7 @@ if (process.env.INPUT_MSGTYPE === 'text') {
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;
}
@@ -25,6 +31,7 @@ if (process.env.INPUT_MSGTYPE === 'text') {
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;
}
@@ -34,6 +41,11 @@ if (process.env.INPUT_MSGTYPE === 'text') {
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,
};
@@ -43,6 +55,15 @@ if (process.env.INPUT_MSGTYPE === 'markdown') {
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,
@@ -59,6 +80,7 @@ if (process.env.INPUT_MSGTYPE === 'news') {
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,
@@ -69,30 +91,49 @@ if (process.env.INPUT_MSGTYPE === 'news') {
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,
};
}
-console.log('The message content in JSON format...');
-console.log(JSON.stringify(payload));
+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('Sending message ...');
+ console.log('[action-wechat-work] Sending message ...');
await axios.post(url, JSON.stringify(payload), {
headers: {
'Content-Type': 'application/json'
},
});
- console.log('Message sent Success! Shutting down ...');
+ console.log('[action-wechat-work] Message sent Success! Shutting down ...');
process.exit(0);
})()
.catch((err) => {
- console.error('Message sent error:');
- err.message && console.error(err.message);
- err.response && err.response.data && console.error(err.response.data);
+ 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);
});