First stab at the apps JSON generation script
continuous-integration/drone/push Build is passing Details

See #121.
This commit is contained in:
decentral1se 2021-03-26 01:14:14 +01:00
parent 701784930b
commit a5ce75a29b
Signed by: decentral1se
GPG Key ID: 92DAD76BD9567B8A
1 changed files with 35 additions and 0 deletions

35
app-json.py Executable file
View File

@ -0,0 +1,35 @@
#!/usr/bin/env python3
from os import chdir, mkdir
from os.path import exists, expanduser
from pathlib import Path
from shlex import split
from subprocess import check_output, run
from requests import get
def clone_apps():
home = expanduser("~/")
clones = Path(f"{home}/.abra/apps").absolute()
if not exists(clones):
mkdir(clones)
response = get("https://git.autonomic.zone/api/v1/orgs/coop-cloud/repos")
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"))
except Exception:
pass
def main():
clone_apps()
if __name__ == "__main__":
main()