mirror of
https://github.com/MillironX/setup-nextflow.git
synced 2024-11-22 01:46: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
42
src/main.ts
42
src/main.ts
|
@ -20,10 +20,12 @@ async function run(): Promise<void> {
|
||||||
let octokit = {}
|
let octokit = {}
|
||||||
try {
|
try {
|
||||||
octokit = github.getOctokit(token)
|
octokit = github.getOctokit(token)
|
||||||
} catch (e) {
|
} catch (e: unknown) {
|
||||||
core.setFailed(
|
if (e instanceof Error) {
|
||||||
`Could not authenticate to GitHub Releases API with provided token\n${e.message}`
|
core.setFailed(
|
||||||
)
|
`Could not authenticate to GitHub Releases API with provided token\n${e.message}`
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the release info for the desired release
|
// Get the release info for the desired release
|
||||||
|
@ -32,10 +34,12 @@ async function run(): Promise<void> {
|
||||||
release = await release_data(version, octokit)
|
release = await release_data(version, octokit)
|
||||||
resolved_version = release.tag_name
|
resolved_version = release.tag_name
|
||||||
core.info(`Input version '${version}' resolved to Nextflow ${release.name}`)
|
core.info(`Input version '${version}' resolved to Nextflow ${release.name}`)
|
||||||
} catch (e) {
|
} catch (e: unknown) {
|
||||||
core.setFailed(
|
if (e instanceof Error) {
|
||||||
`Could not retrieve Nextflow release matching ${version}.\n${e.message}`
|
core.setFailed(
|
||||||
)
|
`Could not retrieve Nextflow release matching ${version}.\n${e.message}`
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the download url for the desired release
|
// Get the download url for the desired release
|
||||||
|
@ -43,8 +47,10 @@ async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
url = nextflow_bin_url(release, get_all)
|
url = nextflow_bin_url(release, get_all)
|
||||||
core.info(`Preparing to download from ${url}`)
|
core.info(`Preparing to download from ${url}`)
|
||||||
} catch (e) {
|
} catch (e: unknown) {
|
||||||
core.setFailed(`Could not parse the download URL\n${e.message}`)
|
if (e instanceof Error) {
|
||||||
|
core.setFailed(`Could not parse the download URL\n${e.message}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// Download Nextflow and add it to path
|
// Download Nextflow and add it to path
|
||||||
|
@ -66,17 +72,21 @@ async function run(): Promise<void> {
|
||||||
core.addPath(nf_path)
|
core.addPath(nf_path)
|
||||||
|
|
||||||
core.info(`Downloaded \`nextflow\` to ${nf_path} and added to PATH`)
|
core.info(`Downloaded \`nextflow\` to ${nf_path} and added to PATH`)
|
||||||
} catch (e) {
|
} catch (e: unknown) {
|
||||||
core.setFailed(e.message)
|
if (e instanceof Error) {
|
||||||
|
core.setFailed(e.message)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run Nextflow so it downloads its dependencies
|
// Run Nextflow so it downloads its dependencies
|
||||||
try {
|
try {
|
||||||
await exec.exec('nextflow', ['help'])
|
await exec.exec('nextflow', ['help'])
|
||||||
} catch (e) {
|
} catch (e: unknown) {
|
||||||
core.warning(
|
if (e instanceof Error) {
|
||||||
'Nextflow appears to have installed correctly, but an error was thrown while running it.'
|
core.warning(
|
||||||
)
|
'Nextflow appears to have installed correctly, but an error was thrown while running it.'
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue