diff --git a/update_app_levels/update_app_levels.py b/update_app_levels/update_app_levels.py index 0770440..12713de 100644 --- a/update_app_levels/update_app_levels.py +++ b/update_app_levels/update_app_levels.py @@ -5,6 +5,7 @@ import tempfile import os import sys import json +from collections import OrderedDict token = open(".github_token").read().strip() @@ -16,7 +17,8 @@ os.system(f"git -C {tmpdir} checkout -b update_app_levels") catalog = toml.load(open(f"{tmpdir}/apps.toml")) # Fetch results from the CI -ci_results = requests.get("https://ci-apps.yunohost.org/ci/logs/list_level_stable_amd64.json").json() +CI_RESULTS_URL = "https://ci-apps.yunohost.org/ci/logs/list_level_stable_amd64.json" +ci_results = requests.get(CI_RESULTS_URL).json() comment = { "major_regressions": [], @@ -55,6 +57,11 @@ for app, infos in catalog.items(): infos["level"] = ci_level +# Also re-sort the catalog keys / subkeys +for app, infos in catalog.items(): + catalog[app] = OrderedDict(sorted(infos.items())) +catalog = OrderedDict(sorted(catalog.items())) + updated_catalog = toml.dumps(catalog) updated_catalog = updated_catalog.replace(",]", " ]") open(f"{tmpdir}/apps.toml", "w").write(updated_catalog)