Skip to content

Instantly share code, notes, and snippets.

@kougazhang
Created June 30, 2021 06:59
Show Gist options
  • Save kougazhang/504b076c612a8038cabbad2e06f5c3cc to your computer and use it in GitHub Desktop.
Save kougazhang/504b076c612a8038cabbad2e06f5c3cc to your computer and use it in GitHub Desktop.
使用git把diff结果写入文件,然后把该文件路径用飞书机器人通知 #shell
#!/bin/zsh
root=<ProjectRoot>
pushd $root
diff=`git diff`
tm=`date +"%Y-%m-%d"`
file=$root/diff-history/$tm
echo $diff > $file
curl -X POST -H "Content-Type: application/json" \
-d "{\"msg_type\":\"text\",\"content\":{\"text\":\"file://$file\"}}" \
<飞书Api>
git add -A .
git commit -m "check@$tm"
git push origin master
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment