1
0
Fork 0
mirror of https://github.com/YunoHost/apps.git synced 2024-09-03 20:06:07 +02:00

Fixes for update_app_levels.py

This commit is contained in:
Alexandre Aubin 2024-02-09 21:41:26 +01:00
parent 3b90fdf74a
commit febe3ad822

View file

@ -9,7 +9,7 @@ import tempfile
import textwrap import textwrap
import time import time
from collections import OrderedDict from collections import OrderedDict
from typing import Any from typing import Any, Optional
from pathlib import Path from pathlib import Path
import jinja2 import jinja2
@ -24,8 +24,8 @@ CI_RESULTS_URL = "https://ci-apps.yunohost.org/ci/api/results"
REPO_APPS_ROOT = Path(Repo(__file__, search_parent_directories=True).working_dir) REPO_APPS_ROOT = Path(Repo(__file__, search_parent_directories=True).working_dir)
def github_token() -> str | None: def github_token() -> Optional[str]:
github_token_path = REPO_APPS_ROOT.parent / ".github_token" github_token_path = REPO_APPS_ROOT / ".github_token"
if github_token_path.exists(): if github_token_path.exists():
return github_token_path.open("r", encoding="utf-8").read().strip() return github_token_path.open("r", encoding="utf-8").read().strip()
return None return None
@ -129,13 +129,13 @@ def pretty_changes(changes: dict[str, list[tuple[str, int, int]]]) -> str:
{%- if changes["missing"] %} {%- if changes["missing"] %}
### Missing 🫠 ### Missing 🫠
{% for app in changes["missing"] %} {% for app in changes["missing"] %}
- [{{app}} (See latest job if it exists)](https://ci-apps.yunohost.org/ci/apps/{{app.0}}/latestjob) - [{{app}} (See latest job if it exists)](https://ci-apps.yunohost.org/ci/apps/{{app}}/latestjob)
{%- endfor %} {%- endfor %}
{% endif %} {% endif %}
{%- if changes["outdated"] %} {%- if changes["outdated"] %}
### Outdated ⏰ ### Outdated ⏰
{% for app in changes["outdated"] %} {% for app in changes["outdated"] %}
- [ ] [{{app}} (See latest job if it exists)](https://ci-apps.yunohost.org/ci/apps/{{app.0}}/latestjob) - [ ] [{{app}} (See latest job if it exists)](https://ci-apps.yunohost.org/ci/apps/{{app}}/latestjob)
{%- endfor %} {%- endfor %}
{% endif %} {% endif %}
""") """)
@ -213,7 +213,7 @@ def main():
logging.info("Committing and pushing the new catalog...") logging.info("Committing and pushing the new catalog...")
apps_repo.index.add("apps.toml") apps_repo.index.add("apps.toml")
apps_repo.index.commit("Update app levels according to CI results") apps_repo.index.commit("Update app levels according to CI results")
apps_repo.remote().push(force=True) apps_repo.git.push("--set-upstream", "origin", new_branch)
if args.verbose: if args.verbose:
print(pr_body) print(pr_body)