Update script.js
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Sthope 2023-08-28 18:30:26 +02:00
parent 36ac68f38e
commit 792514c4ac

View File

@ -1,22 +1,23 @@
const axios = require("axios"); const axios = require("axios");
async function getLatestReleaseTag() { function getLatestReleaseTag() {
const repoOwner = "insignia-live"; const repoOwner = "insignia-live";
const repoName = "setup-assistant-release"; const repoName = "setup-assistant-release";
try { return axios
const response = await axios.get(`https://api.github.com/repos/${repoOwner}/${repoName}/releases/latest`); .get(`https://api.github.com/repos/${repoOwner}/${repoName}/releases/latest`)
return response.data.tag_name; .then((response) => response.data.tag_name)
} catch (error) { .catch((error) => {
console.error("Error fetching latest release tag:", error.message); console.error("Error fetching latest release tag:", error.message);
return "0.0.0"; // Return a default value in case of an error return "0.0.0"; // Return a default value in case of an error
});
}
getLatestReleaseTag().then((latestReleaseTag) => {
const targetReleaseTag = "2023-02-13-1223"; // Replace with your target release tag
// Compare release tags as strings
if (latestReleaseTag > targetReleaseTag) {
console.log("This pipeline is run because the new release is newer than the one I have.");
} }
} });
const latestReleaseTag = await getLatestReleaseTag();
const targetReleaseTag = "2023-02-13-1223"; // Replace with your target release tag
// Compare release tags as strings
if (latestReleaseTag > targetReleaseTag) {
console.log("This pipeline is run because the new release is newer than the one I have.");
}