-
Notifications
You must be signed in to change notification settings - Fork 3
/
autocommit.py
29 lines (22 loc) · 882 Bytes
/
autocommit.py
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
import time, subprocess, os
gitpath = r"C:\Program Files (x86)\Git\bin\git.exe"
plinkpath = r"C:\Users\Alex\plink.exe"
def runcmd(args):
si = subprocess.STARTUPINFO()
si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
si.wShowWindow = subprocess.SW_HIDE
proc = subprocess.Popen(args, executable=gitpath, stdin=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False, startupinfo=si)
stdout, stderr = proc.communicate()
stdout = stdout.decode('utf-8', 'replace')
stderr = stderr.decode('utf-8', 'replace')
print(stdout)
print(stderr)
def commit():
runcmd("git add .")
runcmd("git add -u")
runcmd("git commit -m \"Automatic commit.\" --allow-empty")
os.environ["GIT_SSH"] = plinkpath
runcmd("git push origin master --force")
while True:
time.sleep(15*60)
commit()