summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2022-11-04 11:58:57 +0200
committerYuval Adam <_@yuv.al>2022-11-04 11:58:57 +0200
commit0b09c1cffc7a22a5645c996da06f6396691753c4 (patch)
tree3926a1c1d4609ccb7bd48b3e9639e7bee7e0fc81
parentb7f483bb2d17de1d4d5e4d4d454dad2edc50d4fa (diff)
Add github PR script
-rw-r--r--ghpr.py25
1 files changed, 25 insertions, 0 deletions
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"])