From 356512cd5eab99c2cbc0d373afd71d8d429ca634 Mon Sep 17 00:00:00 2001 From: Auxior Date: Fri, 5 Jan 2024 10:33:21 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E9=A3=9E=E4=B9=A6=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- workflows/utils/env.js | 4 ++++ workflows/utils/notification-kit.ts | 37 +++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/workflows/utils/env.js b/workflows/utils/env.js index 4665ebcc..369c2aff 100644 --- a/workflows/utils/env.js +++ b/workflows/utils/env.js @@ -35,4 +35,8 @@ module.exports = { * https://sct.ftqq.com/sendkey */ SERVERPUSHKEY: env.SERVERPUSHKEY, + /** + * 飞书配置 + */ + FEISHU_WEBHOOK: env.FEISHU_WEBHOOK }; diff --git a/workflows/utils/notification-kit.ts b/workflows/utils/notification-kit.ts index 24c58800..7615728b 100644 --- a/workflows/utils/notification-kit.ts +++ b/workflows/utils/notification-kit.ts @@ -15,6 +15,7 @@ interface DingTalkOptions extends NotificationOptions {} interface PushPlusOptions extends NotificationOptions {} interface WeComOptions extends NotificationOptions {} interface WeiXinOptions extends WeComOptions {} +interface FeiShuOptions extends NotificationOptions {} export class NotificationKit { /** @@ -145,10 +146,10 @@ export class NotificationKit { const config = { title: options.title, desp: options.content, - channel: "9", + channel: "9" }; - return axios.post(`https://sctapi.ftqq.com/${token}.send`, config, { + return axios.post(`https://sctapi.ftqq.com/${token}.send`, config, { headers: { "Content-Type": "application/json" } @@ -173,6 +174,37 @@ export class NotificationKit { }); } + /** + * 飞书Webhook + * @param options + */ + async feishuWebhook(options: FeiShuOptions) { + const url: string | unknown = env.FEISHU_WEBHOOK; + if (!url || url === "") { + throw new Error("未配置飞书Webhook。"); + } + + return axios.post(url as string, { + msg_type: "interactive", + card: { + elements: [ + { + tag: "markdown", + content: options.content, + text_align: "left" + } + ], + header: { + template: "blue", + title: { + content: options.title, + tag: "plain_text" + } + } + } + }); + } + /** * 企业微信Webhook * @param options @@ -230,6 +262,7 @@ export class NotificationKit { await trycatch("微信", this.wecomWebhook.bind(this)); await trycatch("PushPlus", this.pushplus.bind(this)); await trycatch("Server酱", this.serverPush.bind(this)); + await trycatch("飞书", this.feishuWebhook.bind(this)); } } From 0a3b6d747e52224ee7e26dea1fab601c2da147a1 Mon Sep 17 00:00:00 2001 From: Auxior Date: Fri, 5 Jan 2024 10:38:04 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9C=A8=20feat:=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E9=A3=9E=E4=B9=A6Secrets=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/auto.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/auto.yml b/.github/workflows/auto.yml index e4f9ca54..10a2e6d9 100644 --- a/.github/workflows/auto.yml +++ b/.github/workflows/auto.yml @@ -18,6 +18,7 @@ env: PUSHPLUS_TOKEN: ${{ secrets.PUSHPLUS_TOKEN }} WEIXIN_WEBHOOK: ${{ secrets.WEIXIN_WEBHOOK }} SERVERPUSHKEY: ${{ secrets.SERVERPUSHKEY }} + FEISHU_WEBHOOK: ${{ secrets.FEISHU_WEBHOOK }} jobs: CheckIn: @@ -30,6 +31,7 @@ jobs: cd workflows yarn yarn checkin + # SeaGold: # needs: CheckIn # runs-on: ubuntu-latest From 44dfde8cf51b5abe96a8c642611bf929067b3ed0 Mon Sep 17 00:00:00 2001 From: Auxior Date: Fri, 5 Jan 2024 10:49:01 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=F0=9F=93=83=20docs:=20README=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=A3=9E=E4=B9=A6=E6=8E=A8=E9=80=81=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 22505a90..a22023a2 100644 --- a/README.md +++ b/README.md @@ -27,17 +27,18 @@ 2. 仓库 -> Settings -> Secrets -> New repository secret, 添加Secrets变量如下: - | Name | Value | Required | - | --- | --- | --- | - | COOKIE | 掘金网站Cookie | 是 | - | COOKIE_2 | 多用户, 当需要同时运行多个掘金用户时所需, 支持最多 **5** 名用户(即COOKIE + COOKIE_2 - COOKIE_5) | 否 | - | EMAIL_USER | 发件人邮箱地址(需要开启 SMTP) | 否 | - | EMAIL_PASS | 发件人邮箱密码(SMTP密码) | 否 | - | EMAIL_TO | 订阅人邮箱地址(收件人). 如需多人订阅使用 `, ` 分割, 例如: `a@163.com, b@qq.com` | 否 | - | DINGDING_WEBHOOK | 钉钉机器人WEBHOOK | 否 | - | PUSHPLUS_TOKEN | [Pushplus](http://www.pushplus.plus/) 官网申请,支持微信消息推送 | 否 | - | SERVERPUSHKEY | [Server酱](https://sct.ftqq.com//) 官网申请,支持微信消息推送 | 否 | + | Name | Value | Required | + | --- | --- | --- | + | COOKIE | 掘金网站Cookie | 是 | + | COOKIE_2 | 多用户, 当需要同时运行多个掘金用户时所需, 支持最多 **5** 名用户(即COOKIE + COOKIE_2 - COOKIE_5) | 否 | + | EMAIL_USER | 发件人邮箱地址(需要开启 SMTP) | 否 | + | EMAIL_PASS | 发件人邮箱密码(SMTP密码) | 否 | + | EMAIL_TO | 订阅人邮箱地址(收件人). 如需多人订阅使用 `, ` 分割, 例如: `a@163.com, b@qq.com` | 否 | + | DINGDING_WEBHOOK | 钉钉机器人WEBHOOK | 否 | + | PUSHPLUS_TOKEN | [Pushplus](http://www.pushplus.plus/) 官网申请,支持微信消息推送 | 否 | + | SERVERPUSHKEY | [Server酱](https://sct.ftqq.com//) 官网申请,支持微信消息推送 | 否 | | WEIXIN_WEBHOOK | 企业微信机器人WEBHOOK | 否 | + | FEISHU_WEBHOOK | 飞书机器人WEBHOOK | 否 | 4. 仓库 -> Actions, 检查Workflows并启用。