From 426ea91d4cf57d5e765ca73a1c8b468df373c61a Mon Sep 17 00:00:00 2001 From: Tagadda <36127788+Tagadda@users.noreply.github.com> Date: Tue, 22 Feb 2022 23:44:44 +0000 Subject: [PATCH] Add a warning when not on a master branch --- tools/README-generator/make_readme.py | 4 ++++ tools/README-generator/templates/README.md.j2 | 2 +- tools/README-generator/templates/README_fr.md.j2 | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/README-generator/make_readme.py b/tools/README-generator/make_readme.py index ddcc3d29..d00e1edf 100755 --- a/tools/README-generator/make_readme.py +++ b/tools/README-generator/make_readme.py @@ -53,6 +53,9 @@ def generate_READMEs(app_path: str): else: disclaimer = None + # Get the current branch using git inside the app path + branch = os.popen("git --git-dir=%s/.git --work-tree=%s rev-parse --abbrev-ref HEAD" % (app_path, app_path)).read().strip() + out = template.render( lang=lang, upstream=upstream, @@ -60,6 +63,7 @@ def generate_READMEs(app_path: str): screenshots=screenshots, disclaimer=disclaimer, manifest=manifest, + branch=branch, ) (app_path / f"README{lang_suffix}.md").write_text(out) diff --git a/tools/README-generator/templates/README.md.j2 b/tools/README-generator/templates/README.md.j2 index 6e58002a..b0eb5c26 100644 --- a/tools/README-generator/templates/README.md.j2 +++ b/tools/README-generator/templates/README.md.j2 @@ -31,7 +31,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in {% if description %}{{description}}{% else %}{{manifest.description[lang]}}{% endif %} -**Shipped version:** {% if upstream.version %}{{upstream.version}}{% else %}{{manifest.version}}{% endif %} +**Shipped version:** {% if upstream.version %}{{upstream.version}}{% else %}{{manifest.version}}{% endif %}{% if branch != "master" %} *(This is the `{{ branch }}` branch. See the [`master` branch](https://github.com/YunoHost-Apps/{{manifest.id}}_ynh/tree/master) for the version in the catalog.)*{% endif %} {% if upstream.demo %}**Demo:** {{upstream.demo}}{% endif %} diff --git a/tools/README-generator/templates/README_fr.md.j2 b/tools/README-generator/templates/README_fr.md.j2 index 9169cbbd..63ca8c49 100644 --- a/tools/README-generator/templates/README_fr.md.j2 +++ b/tools/README-generator/templates/README_fr.md.j2 @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour {% if description %}{{description}}{% else %}{{manifest.description[lang]}}{% endif %} -**Version incluse :** {% if upstream.version %}{{upstream.version}}{% else %}{{manifest.version}}{% endif %} +**Version incluse :** {% if upstream.version %}{{upstream.version}}{% else %}{{manifest.version}}{% endif %}{% if branch != "master" %} *(Vous êtes sur la branche `{{ branch }}`. Voir la [branche `master`](https://github.com/YunoHost-Apps/{{manifest.id}}_ynh/tree/master) pour la version du catalogue.)*{% endif %} {% if upstream.demo %}**Démo :** {{upstream.demo}}{% endif %}