summaryrefslogtreecommitdiff
path: root/scripts/ghpr.py
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2022-11-14 23:03:38 +0200
committerGitHub <noreply@github.com>2022-11-14 23:03:38 +0200
commit19928dde097a131fbcc2b73f7ba1142c6e6ee7cc (patch)
treed49e7ecde7b60d89bb208df4596f8b184dc4e41f /scripts/ghpr.py
parente73e33f43f31aaf2ae3bcea808941cd5bad37112 (diff)
Unify scripts/ directory (#52)
* Unify scripts/ directory * Keep build.py in root for simplicity
Diffstat (limited to 'scripts/ghpr.py')
-rw-r--r--scripts/ghpr.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/ghpr.py b/scripts/ghpr.py
new file mode 100644
index 0000000..4e9a124
--- /dev/null
+++ b/scripts/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", "-t", f"Add {domain}", "-b", f"Hey @{handle}, would you like to merge this PR adding you to https://namehack.club?"])
+ run(["git", "checkout", "main"])