LoginSignup
0
3

More than 5 years have passed since last update.

gitプッシュ時にSlackに投稿する

Posted at

gitプッシュ時にSlackに投稿する

hooks/post-receiveに以下を記載

post-receive
#!/bin/bash                                                                                                                                   

MESSAGE=$(git log -1 --pretty=format:"%h - %an : %s" --branches)
TEXT="text="${MESSAGE}
TOKEN="token=[取得したToken]"
CHANNEL="channel=[投稿したいチャンネル]"
USER="user="$(whoami)

curl -XPOST -d ${TOKEN} -d ${CHANNEL} -d "${TEXT}" -d 'as_user=true' -d ${USER} 'https://slack.com/api/chat.postMessage'
0
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3