Pull Request Notification to Enterprise WeChat Group
About 213 wordsLess than 1 minute
Add Group Bot
Add a bot to your Enterprise WeChat group and copy the Webhook URL.
Configure Pipeline
The core of the notification is the tencentcom/wecom-message plugin, with the content field for custom message content. Replace robot with the actual Webhook URL.
Below is the configuration for three common PR events: pull_request, pull_request.changes_requested, and pull_request.merged:
.cnb.yml
main:
pull_request:
- stages:
- name: notice
image: tencentcom/wecom-message
settings:
robot: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxx
content: |
> **Pull Request Needs Review:**
> **Title:** ${CNB_PULL_REQUEST_TITLE}
> **Creator:** ${CNB_PULL_REQUEST_PROPOSER}
> [View Details]($CNB_EVENT_URL)
pull_request.changes_requested:
- stages:
- name: notice
image: tencentcom/wecom-message
settings:
robot: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxx
content: |
> **${CNB_BUILD_USER} requested changes**
> **Title:** ${CNB_PULL_REQUEST_TITLE}
> [View Details]($CNB_EVENT_URL)
pull_request.merged:
- stages:
- name: notice
image: tencentcom/wecom-message
settings:
robot: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxx
content: |
> **Pull Request Merged**
> **Title:** ${CNB_PULL_REQUEST_TITLE}
> [View Details]($CNB_EVENT_URL)Other PR events (such as pull_request.mergeable) follow the same pattern — just change the event name and content. pull_request.mergeable can be combined with the git:auto-merge built-in task for automatic merging followed by notification.
For available variables, see Environment Variables.