Skip to content

Commit

Permalink
errors from api?
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelnlindsay committed Jul 1, 2024
1 parent f88f79e commit 753b04f
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions .github/actions-scripts/validate-release-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ async function validateReleaseVersion() {

const { version } = require(`${workspace}/package.json`);

try {
const { data: latest } = await octokit.request(`GET /repos/${owner}/${repo}/releases/latest`, gh_api_header)

var releases = await octokit.Repository.Release.GetAll("${owner}", "${repo}");
var latest = releases.Result.ElementAt(0);
// const { data: latest } = await octokit.request(`GET /repos/${owner}/${repo}/releases/latest`, gh_api_header)

// Version set in package.json must be greater than latest
console.log("Package Version: ", version, "Latest Version: ", latest.name)
if (! semver.gt(version, latest.name)) {
console.log("version property in package.json must be greater than: ", latest.name)
// Version set in package.json must be greater than latest
console.log("Package Version: ", version, "Latest Version: ", latest.name)
if (! semver.gt(version, latest.name)) {
console.log("version property in package.json must be greater than: ", latest.name)
// process.exit(1);
}
} catch (error) {
console.log("could not load latest error ", error.status, error.message)
process.exit(1);
}
return version;
Expand Down

0 comments on commit 753b04f

Please sign in to comment.