From 0b09c1cffc7a22a5645c996da06f6396691753c4 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Fri, 4 Nov 2022 11:58:57 +0200 Subject: Add github PR script --- ghpr.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 ghpr.py diff --git a/ghpr.py b/ghpr.py new file mode 100644 index 0000000..ce96278 --- /dev/null +++ b/ghpr.py @@ -0,0 +1,25 @@ +import sys + +from pathlib import Path +from subprocess import run + +ROOT_PATH = Path(__file__).parent + +path = sys.argv[1] + +with open(path, "r") as f: + for line in f: + l = line.strip().split(",") + domain, handle, name = [x.strip() for x in l] + + fn = domain.replace(".", "") + with open(ROOT_PATH / "names" / f"{fn}.yml", "w") as out: + s = f"domain: {domain}\nname: {name}\ngithub: {handle}\n" + out.write(s) + + run(["git", "checkout", "-b", domain]) + run(["git", "add", f"names/{fn}.yml"]) + run(["git", "commit", "-m", f"Add {domain}"]) + run(["git", "push", "-u", "origin", domain]) + run(["gh", "pr", "create", "-f"]) + run(["git", "checkout", "main"]) -- cgit v1.3.1