summaryrefslogtreecommitdiff
path: root/githooks/merchant/post-receive
blob: 001cfa7bda50d8e235c80241ef987881a3a973ea (plain)
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
#!/usr/bin/python3

import sys
import os

lines = sys.stdin.readlines()

print("executing merchant post-receive hook")

updated = set()

for line in lines:
    try:
        old, new, name = line.split()
    except ValueError:
        print("unexpected format")
        os.exit(1)
    updated.add(name)

if "refs/heads/test" in updated:
    ret = os.system("echo merchant | timeout 1s tee /home/test/rebuild >/dev/null")
    if ret != 0:
        print("merchant update failed")
    else:
        print("updating merchant")