Fix non-master branch switching for repos

This commit is contained in:
decentral1se 2021-03-26 20:21:37 +01:00
parent fc12634fbb
commit a5274f123c
Signed by untrusted user who does not match committer: decentral1se
GPG Key ID: 92DAD76BD9567B8A
1 changed files with 5 additions and 4 deletions

View File

@ -19,10 +19,11 @@ def clone_apps():
repos = [[p["name"], p["ssh_url"]] for p in response.json()]
for name, url in repos:
try:
run(split(f"git clone {url} {clones}/{name}"))
chdir(f"{clones}/{name}")
if not check_output("git branch --list | wc -l", shell=True):
run(split("git checkout main"))
if not exists(f"{clones}/{name}"):
run(split(f"git clone {url} {clones}/{name}"))
chdir(f"{clones}/{name}")
if not int(check_output("git branch --list | wc -l", shell=True)):
run(split("git checkout main"))
except Exception:
pass