mirror of
https://github.com/MillironX/setup-nextflow.git
synced 2024-11-21 17:36:04 +00:00
chore: Clean up some catch errors
This commit is contained in:
parent
a14c1ba3a6
commit
955a936296
1 changed files with 26 additions and 16 deletions
20
src/main.ts
20
src/main.ts
|
@ -20,11 +20,13 @@ async function run(): Promise<void> {
|
|||
let octokit = {}
|
||||
try {
|
||||
octokit = github.getOctokit(token)
|
||||
} catch (e) {
|
||||
} catch (e: unknown) {
|
||||
if (e instanceof Error) {
|
||||
core.setFailed(
|
||||
`Could not authenticate to GitHub Releases API with provided token\n${e.message}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Get the release info for the desired release
|
||||
let release = {}
|
||||
|
@ -32,20 +34,24 @@ async function run(): Promise<void> {
|
|||
release = await release_data(version, octokit)
|
||||
resolved_version = release.tag_name
|
||||
core.info(`Input version '${version}' resolved to Nextflow ${release.name}`)
|
||||
} catch (e) {
|
||||
} catch (e: unknown) {
|
||||
if (e instanceof Error) {
|
||||
core.setFailed(
|
||||
`Could not retrieve Nextflow release matching ${version}.\n${e.message}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// Get the download url for the desired release
|
||||
let url = ''
|
||||
try {
|
||||
url = nextflow_bin_url(release, get_all)
|
||||
core.info(`Preparing to download from ${url}`)
|
||||
} catch (e) {
|
||||
} catch (e: unknown) {
|
||||
if (e instanceof Error) {
|
||||
core.setFailed(`Could not parse the download URL\n${e.message}`)
|
||||
}
|
||||
}
|
||||
try {
|
||||
// Download Nextflow and add it to path
|
||||
let nf_path = ''
|
||||
|
@ -66,18 +72,22 @@ async function run(): Promise<void> {
|
|||
core.addPath(nf_path)
|
||||
|
||||
core.info(`Downloaded \`nextflow\` to ${nf_path} and added to PATH`)
|
||||
} catch (e) {
|
||||
} catch (e: unknown) {
|
||||
if (e instanceof Error) {
|
||||
core.setFailed(e.message)
|
||||
}
|
||||
}
|
||||
|
||||
// Run Nextflow so it downloads its dependencies
|
||||
try {
|
||||
await exec.exec('nextflow', ['help'])
|
||||
} catch (e) {
|
||||
} catch (e: unknown) {
|
||||
if (e instanceof Error) {
|
||||
core.warning(
|
||||
'Nextflow appears to have installed correctly, but an error was thrown while running it.'
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
run()
|
||||
|
|
Loading…
Reference in a new issue