From d7fb511e5c7ba463c39b052a42348552bdfb3183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Thu, 12 Sep 2024 00:34:40 +0300 Subject: [PATCH] fix(website): handle GitHub release version correctly --- website/src/components/Footer/Version.astro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/website/src/components/Footer/Version.astro b/website/src/components/Footer/Version.astro index 3a7e7e3..baed85d 100644 --- a/website/src/components/Footer/Version.astro +++ b/website/src/components/Footer/Version.astro @@ -3,11 +3,11 @@ const { owner, repo } = Astro.props; let latestVersion = "0.0.0"; try { - const response = await fetch(`https://api.github.com/repos/${owner}/${repo}/releases`); + const response = await fetch(`https://api.github.com/repos/${owner}/${repo}/releases/latest`); if (response.ok) { const data = await response.json(); - if (data.length > 0) { - latestVersion = data[0].name.replace(/^v/, ""); + if (data.tag_name) { + latestVersion = data.tag_name; } } } catch (error) {