【发布时间】:2019-01-16 23:42:42
【问题描述】:
每当有人向主人推送时,我都会尝试在我们的不和谐中发布一条信息消息。
我有一个如下所示的接收后 bash 脚本:
#!/bin/bash
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]];
then
tail=$(git log -1 --pretty=format:'%h %cn: %s%b' $newrev)
url='https://discordapp.com/api/webhooks/validapikey'
curl -i \
-H "Accept: application/json" \
-H "Content-Type:application/json" \
-X POST \
--data '{"content": "'$tail'"}' $url
fi
done
如果我将 tail 输出到文件,我会得到预期的字符串
6baf5 user: last commit message
但该消息并未在 discord 上发布
如果我将 $tail 替换为“hello”,它就会被发布。
【问题讨论】:
-
不和谐的想法很不错,我喜欢它,伙计
标签: bash curl discord githooks