feat: Add error handling to getLatestVersion()
This commit is contained in:
parent
2d7a42afa8
commit
bc7b30b91d
1 changed files with 37 additions and 39 deletions
16
index.js
16
index.js
|
|
@ -6,7 +6,8 @@ const getLatestVersion = require("./get-latest-version");
|
||||||
// most @actions toolkit packages have async methods
|
// most @actions toolkit packages have async methods
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
getLatestVersion().then(async function(latestVersion) {
|
getLatestVersion().then(
|
||||||
|
async function(latestVersion) {
|
||||||
let hugoVersion = core.getInput("hugo-version");
|
let hugoVersion = core.getInput("hugo-version");
|
||||||
if (!hugoVersion || hugoVersion === "latest") {
|
if (!hugoVersion || hugoVersion === "latest") {
|
||||||
hugoVersion = latestVersion;
|
hugoVersion = latestVersion;
|
||||||
|
|
@ -38,14 +39,11 @@ async function run() {
|
||||||
const hugoExtractedFolder = await tc.extractTar(hugoTarball, "/tmp");
|
const hugoExtractedFolder = await tc.extractTar(hugoTarball, "/tmp");
|
||||||
core.debug("hugoExtractedFolder:", hugoExtractedFolder);
|
core.debug("hugoExtractedFolder:", hugoExtractedFolder);
|
||||||
await io.mv(`${hugoExtractedFolder}/hugo`, hugoPath);
|
await io.mv(`${hugoExtractedFolder}/hugo`, hugoPath);
|
||||||
// },
|
},
|
||||||
// function(error) {
|
function(error) {
|
||||||
// console.error(error);
|
console.error(error);
|
||||||
// console.log(
|
}
|
||||||
// "HINT: GitHub API Rate limiting",
|
);
|
||||||
// "https://developer.github.com/v3/#rate-limiting"
|
|
||||||
// );
|
|
||||||
});
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue