#!/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(' ') if not refname == "refs/heads/main": print(f"Skipping ref \"{refname}\"") 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}")