From 59fcb2f5e4eb8f1af4daf66c1e15f9ffd02f982f Mon Sep 17 00:00:00 2001 From: Jonathan Guyer Date: Sun, 16 Jul 2023 12:52:18 -0400 Subject: [PATCH] Link to actual GitHub ref in tree --- update_pages/ntd2d_action/files/menufile.py | 4 +++- update_pages/ntd2d_action/files/templates/menu.html | 2 +- update_pages/ntd2d_action/variants.py | 8 ++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/update_pages/ntd2d_action/files/menufile.py b/update_pages/ntd2d_action/files/menufile.py index 06a2b10..59230e1 100644 --- a/update_pages/ntd2d_action/files/menufile.py +++ b/update_pages/ntd2d_action/files/menufile.py @@ -25,9 +25,11 @@ def get_contents(self): else: downloads = "" + tree_url = f"{self.repo.tree_url}/{self.variant.true_name}" + menu_template = PagesTemplate(working_dir=self.repo.working_dir, name="menu.html").read() return menu_template.format(variants=textwrap.indent(variants, " "), branch=self.variant.name, downloads=textwrap.indent(downloads, " "), - tree_url=self.repo.tree_url) + tree_url=tree_url) diff --git a/update_pages/ntd2d_action/files/templates/menu.html b/update_pages/ntd2d_action/files/templates/menu.html index 085a1ee..fb37c3e 100644 --- a/update_pages/ntd2d_action/files/templates/menu.html +++ b/update_pages/ntd2d_action/files/templates/menu.html @@ -8,7 +8,7 @@

Versions

GitHub

diff --git a/update_pages/ntd2d_action/variants.py b/update_pages/ntd2d_action/variants.py index 8c2852c..e7395b3 100644 --- a/update_pages/ntd2d_action/variants.py +++ b/update_pages/ntd2d_action/variants.py @@ -8,9 +8,13 @@ from .files import VariantsFile, MenuFile, IndexFile, CSSFile class Variant: - def __init__(self, repo, name): + def __init__(self, repo, name, true_name=None): self.repo = repo self.name = name + if true_name is None: + self.true_name = name + else: + self.true_name = true_name self.downloads = {} self.dir = repo.working_dir / "html" / name @@ -61,7 +65,7 @@ def clone(self, name, cls=None): gha_utils.debug(f"{self.name}.clone({name})") if cls is None: cls = self.__class__ - clone = cls(repo=self.repo, name=name) + clone = cls(repo=self.repo, name=name, true_name=self.true_name) # this will clone any files in _static and _downloads, too clone.copy_html(src=self.dir) dst = clone.dir / "_downloads"