From 9a42bf633e86bfb04e9ccbe38856ae2ea8d0d468 Mon Sep 17 00:00:00 2001 From: Janos <86970079+janosdebugs@users.noreply.github.com> Date: Wed, 28 Jul 2021 08:58:33 +0200 Subject: [PATCH] More testing --- index.js | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/index.js b/index.js index 5fe8a33..458d6b8 100644 --- a/index.js +++ b/index.js @@ -63,24 +63,27 @@ async function downloadGofmt(octokit, version, versionPrefix, org, repo) { } } } + console.log("Failed to find a release matching the criteria.") throw "Failed to find a release matching the criteria." } -try { - // versionPrefix is the prefix of the version gotestfmt-action supports. - const versionPrefix = "v1." - const token = core.getInput('token'); - const version = core.getInput('version'); - const org = core.getInput("org") - const repo = core.getInput("repo") - const octokit = new Octokit({ - auth: token, - }) - downloadGofmt(octokit, version, versionPrefix, org, repo).then(function () { - console.log("Download successful.") - }).catch(reason => function() { - core.setFailed(reason); - }) -} catch (error) { - core.setFailed(error.message); -} \ No newline at end of file +async function main() { + try { + // versionPrefix is the prefix of the version gotestfmt-action supports. + const versionPrefix = "v1." + const token = core.getInput('token'); + const version = core.getInput('version'); + const org = core.getInput("org") + const repo = core.getInput("repo") + const octokit = new Octokit({ + auth: token, + }) + await downloadGofmt(octokit, version, versionPrefix, org, repo) + console.log("Setup complete.") + } catch (error) { + console.log("Setup failed.") + core.setFailed(error); + } +} + +main()