-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathsvn-post-commit.sh
More file actions
52 lines (38 loc) · 1.19 KB
/
Copy pathsvn-post-commit.sh
File metadata and controls
52 lines (38 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
#
# Subversion post commit hook example. Please change YOUR parts.
#
# - Drop this file as post-commit in /srv/svnrepts/YOURREPO/hooks
# - chmod u+x
# - Change owner to www-data:www-data if you are running Subversion under Apache: chown www-data:www-data post-commit
#
# http://www.jasongrimes.org/2011/07/automatically-announce-subversion-commits-on-yammer-with-svn2yammer/
#
# To test this example run on the server:
#
# /usr/bin/svnlook youngest /srv/svnreps/red # get revision
# /srv/svnreps/red/hooks/post-commit /srv/svnreps/red 11301 # Test msg push
#
repo="$1"
rev="$2"
svnlook="/usr/bin/svnlook"
# Get last commit author
author=`$svnlook author $repo`
# Get last commit message
commit_message=`$svnlook log $repo`
# List of changed files
changed=`$svnlook changed $repo`
# Chat id
chat="YOUR-CHAT-ID-HERE"
# Shared secret
secret="YOUR-SHARED-SECRET-HERE"
msg="★ $author - $commit_message
$changed"
msgaddress="http://YOURSERVER.COM:5000/msg/"
md5=`echo -n "$chat$msg$secret" | md5sum`
#md5sum prints a '-' to the end. Let's get rid of that.
for m in $md5; do
break
done
curl $msgaddress --data-urlencode chat="$chat" --data-urlencode msg="$msg" --data-urlencode md5="$m"
exit 0