mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2026-01-24 20:12:15 +01:00
add: about GitHub API Rate limiting
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
|
||||
|
||||
function getLatestVersion() {
|
||||
return new Promise((resolve) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const xhr = new XMLHttpRequest();
|
||||
const url = "https://api.github.com/repos/gohugoio/hugo/releases/latest";
|
||||
xhr.open("GET", url);
|
||||
@@ -15,11 +15,11 @@ function getLatestVersion() {
|
||||
|
||||
resolve(latestVersion);
|
||||
} else {
|
||||
throw new Error(`ERROR: got status ${xhr.status}`);
|
||||
// reject(`ERROR: got status ${xhr.status}`);
|
||||
reject(`ERROR: got status ${xhr.status}`);
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = getLatestVersion;
|
||||
v
|
||||
Reference in New Issue
Block a user