diff options
| author | Yuval Adam <_@yuv.al> | 2022-11-04 11:58:57 +0200 |
|---|---|---|
| committer | Yuval Adam <_@yuv.al> | 2022-11-04 11:58:57 +0200 |
| commit | 0b09c1cffc7a22a5645c996da06f6396691753c4 (patch) | |
| tree | 3926a1c1d4609ccb7bd48b3e9639e7bee7e0fc81 | |
| parent | b7f483bb2d17de1d4d5e4d4d454dad2edc50d4fa (diff) | |
Add github PR script
| -rw-r--r-- | ghpr.py | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -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"]) |
