结合两个后接收挂钩

时间:2015-12-01 19:18:24

标签: linux git shell githooks slack

如何组合两个后接收挂钩?第一个是git-slack integration并使用以下循环运行:

After:=.Cells(1,1)

,第二个是我的部署,看起来像这样:

while read line
do
  set -- $line
  notify $*
  RET=$?
done

无论我使用git的哪个分支,我都希望能够向slack发送通知。

有关如何组合两个循环的任何提示?

1 个答案:

答案 0 :(得分:2)

这尚未经过测试但应该有效:

while read oldrev newrev refname line
do
  set -- "$oldrev $newrev $refname $line"
  notify $*

  # Not sure the return value is needed since it isn't being used anywhere
  RET=$?

  branch=$(git rev-parse --symbolic --abbrev-ref $refname)
  if [ "master" = "$branch" ]; then
    # some deployment commands
  elif [ "development" = "$branch" ]; then
   # some other deployment commands
  fi
done

希望这有帮助