git-lfs-test/build/git-post-receive-hook

24 lines
758 B
Text
Raw Normal View History

2023-12-15 21:31:38 +01:00
#!/usr/bin/env python
from shlex import quote
from subprocess import run
import os
import sys
for line in sys.stdin:
precommit, postcommit, refname = line.strip().split(' ')
2023-12-15 21:31:38 +01:00
if not refname == "refs/heads/main":
print(f"Skipping ref \"{refname}\"")
2023-12-15 21:31:38 +01:00
continue
os.putenv("LAMINAR_REASON", "Push to git repository")
cmd = "laminarc queue freeloadio " \
f"CI_COMMIT_BEFORE_SHA={quote(precommit)} " \
f"CI_COMMIT_SHA={quote(postcommit)} " \
f"CI_COMMIT_REF_NAME={quote(refname)}"
print(cmd)
process = run(cmd, shell=True, capture_output=True)
buildname, buildrun = process.stdout.decode().strip().split(':')
print(f"Queued build: https://laminar.ryuslash.org/jobs/{buildname}/{buildrun}")