# issue 信息通知到群聊示例 示例中,配置了如何将 issue 创建、关闭、重新打开信息通知到群聊 ## 涉及文档 - [企业微信通知](https://docs.cnb.cool/zh/plugins/public/tencentcom/wecom-message) - [自动更新 issue](https://docs.cnb.cool/zh/internal-steps/git/issue-update.html) - [imports 环境变量](https://docs.cnb.woa.com/zh/grammar/job.html#imports):可创建密钥仓库,用于存储不希望公开的信息,然后通过 imports 方式引用 - [issue.open 事件](https://docs.cnb.cool/zh/event.html#issue-open) - [issue.reopen 事件](https://docs.cnb.cool/zh/event.html#issue-reopen) - [issue.close 事件](https://docs.cnb.cool/zh/event.html#issue-close) ## 如何配置 - `issue.open` 事件:issue 创建后,会触发 `issue.open` 事件,将 issue 信息通知到群聊 - `issue.reopen` 事件:issue 关闭后被重新打开,会触发 `issue.reopen` 事件,将 issue 信息通知到群聊 - `issue.close` 事件:issue 关闭后,会触发 `issue.close` 事件,将 issue 关闭信息通知到群聊 - `push` 事件:push 事件触发后,使用 [`git:issue-update`](https://docs.cnb.cool/zh/internal-steps/git/issue-update.html) 内置任务自动修改 issue 标签 配置示例: ```yaml # .cnb.yml main: push: - stages: - name: 更新 issue type: git:issue-update options: label: add: 已解决 remove: 开发中 $: issue.open: - stages: - name: issue 信息通知到群聊 image: tencentcom/wecom-message imports: https://cnb.cool/xxx/xxx/-/blob/main/envs/wework-robots.yml settings: robot: $REVIEW_ROBOT_ID msgType: markdown content: | > **有人提issue啦** > **标 题:** $CNB_ISSUE_TITLE > **发起人:** $CNB_ISSUE_OWNER > [查看详情]($CNB_EVENT_URL) issue.reopen: - stages: - name: issue 重新打开信息通知到群聊 image: tencentcom/wecom-message imports: https://cnb.cool/xxx/xxx/-/blob/main/envs/wework-robots.yml settings: robot: $REVIEW_ROBOT_ID content: | > **$CNB_BUILD_USER重新打开了一个issue** > **标 题:** $CNB_ISSUE_TITLE > **发起人:** $CNB_ISSUE_OWNER > [查看详情]($CNB_EVENT_URL) ${REVIEWED_BY} issue.close: - stages: - name: issue 关闭信息通知到群聊 image: tencentcom/wecom-message imports: https://cnb.cool/xxx/xxx/-/blob/main/envs/wework-robots.yml settings: robot: $REVIEW_ROBOT_ID content: | > **$CNB_BUILD_USER关闭了一个issue** > **标 题:** $CNB_ISSUE_TITLE > **发起人:** $CNB_ISSUE_OWNER > [查看详情]($CNB_EVENT_URL) ```