Skip to content

配置Hooks

增加对应脚本放到 .git/hooks


例:每次push的时候推送到飞书群聊

.git/hooks/pre-push

其中 xxx 查看群机器人Webhook 地址

#!/bin/sh
export LC_ALL=zh_CN.GB2312
export LANG=zh_CN.GB2312
hash=$(git rev-parse HEAD)
name=$(git log -1 --pretty=format:'%an')
content=$(git log -1 --pretty=format:'%s')
json_data=$(printf '{"msg_type":"text","content":{"text":"{repository: PlatformConfig, name: %s, content: %s, Link: http://172.16.44.197:8081/q/status:open+-is:wip}"}}' "$name" "$content")
echo "$json_data"
curl -X POST -H "Content-Type: application/json" -d "$json_data" https://open.feishu.cn/open-apis/bot/v2/hook/xxxx