feat: Add error handling to getLatestVersion()

This commit is contained in:
peaceiris 2019-09-18 02:27:59 +09:00
parent 2d7a42afa8
commit bc7b30b91d

View file

@ -6,7 +6,8 @@ const getLatestVersion = require("./get-latest-version");
// most @actions toolkit packages have async methods
async function run() {
try {
getLatestVersion().then(async function(latestVersion) {
getLatestVersion().then(
async function(latestVersion) {
let hugoVersion = core.getInput("hugo-version");
if (!hugoVersion || hugoVersion === "latest") {
hugoVersion = latestVersion;
@ -38,14 +39,11 @@ async function run() {
const hugoExtractedFolder = await tc.extractTar(hugoTarball, "/tmp");
core.debug("hugoExtractedFolder:", hugoExtractedFolder);
await io.mv(`${hugoExtractedFolder}/hugo`, hugoPath);
// },
// function(error) {
// console.error(error);
// console.log(
// "HINT: GitHub API Rate limiting",
// "https://developer.github.com/v3/#rate-limiting"
// );
});
},
function(error) {
console.error(error);
}
);
} catch (error) {
core.setFailed(error.message);
}