Skip to content

添加webhook

添加到个人进行测试

编辑消息格式

https://app.slack.com/block-kit-builder

自定义基本信息

发送通知

js
// 通知到slack
await axios.post(`https://hooks.slack.com/services/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`,{
  "blocks": [
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": ` *工作流结果*\n${steps.join("\n")} \n<https://github.com/${owner}/${repo}/actions/runs/${context.runId}/ | more>`
      }
    },
    {
      "type": "section",
      "text": {
        "type": "mrkdwn",
        "text": `<@${idName[context.payload.sender.login]}>`
      }
    },
  ]
}).then((res) => {
  info("hook res", JSON.stringify(res, null, 2))
}).catch((e) => {
  info("hook err", JSON.stringify(e, null, 2))
})

呈现效果