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
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue