mirror of
https://github.com/fosrl/docs-v2.git
synced 2026-02-10 23:16:42 +00:00
deploy test
This commit is contained in:
15
lib/fetchLatestRelease.js
Normal file
15
lib/fetchLatestRelease.js
Normal file
@@ -0,0 +1,15 @@
|
||||
export async function fetchLatestRelease(repo) {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`https://api.github.com/repos/${repo}/releases/latest`,
|
||||
);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch release info: ${response.statusText}`);
|
||||
}
|
||||
const data = await response.json();
|
||||
const latestVersion = data.tag_name;
|
||||
return latestVersion;
|
||||
} catch (error) {
|
||||
console.error("Error fetching latest release:", error);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user