summaryrefslogtreecommitdiff
path: root/cli/ghpr.py
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2023-05-02 10:23:30 +0300
committerYuval Adam <_@yuv.al>2023-05-02 10:23:30 +0300
commit6de7cb6ec533c9917441cbd4b9a1807f8f1cbe16 (patch)
tree2ae040fd26ce210c1074da912db6a865d88a16d4 /cli/ghpr.py
parent8b514dcdf2a25016c0befa63fca6404a6b805fe9 (diff)
Migrate scan script
Diffstat (limited to 'cli/ghpr.py')
-rw-r--r--cli/ghpr.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/cli/ghpr.py b/cli/ghpr.py
new file mode 100644
index 0000000..6c9f7f9
--- /dev/null
+++ b/cli/ghpr.py
@@ -0,0 +1,35 @@
+import sys
+
+from pathlib import Path
+from subprocess import run
+
+ROOT_PATH = Path(__file__).parents[1]
+
+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]
+ handle = None if "@" in handle else handle
+
+ fn = domain.replace(".", "")
+
+ path = ROOT_PATH / "names" / f"{fn}.yml"
+ if path.exists():
+ print(f"{domain} already exists")
+ continue
+
+ with open(path, "w") as out:
+ s = f"domain: {domain}\nname: {name}\n"
+ if handle:
+ s += f"github: {handle}\n"
+ s += "candidate: true\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"])