mirror of
https://github.com/MillironX/setup-nextflow.git
synced 2024-11-23 10:09:54 +00:00
refactor!: Replace Octokit API with nf-core API in main script
This commit is contained in:
parent
a8257a33e4
commit
8013af975a
1 changed files with 9 additions and 14 deletions
23
src/main.ts
23
src/main.ts
|
@ -11,10 +11,9 @@ import {
|
||||||
} from "./functions"
|
} from "./functions"
|
||||||
import { NextflowRelease } from "./nextflow-release"
|
import { NextflowRelease } from "./nextflow-release"
|
||||||
import {
|
import {
|
||||||
pull_latest_stable_release,
|
get_latest_nextflow_version,
|
||||||
pull_releases,
|
get_nextflow_versions
|
||||||
setup_octokit
|
} from "./nf-core-api-wrapper"
|
||||||
} from "./octokit-wrapper"
|
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
// CAPSULE_LOG leads to a bunch of boilerplate being output to the logs: turn
|
// CAPSULE_LOG leads to a bunch of boilerplate being output to the logs: turn
|
||||||
|
@ -22,29 +21,25 @@ async function run(): Promise<void> {
|
||||||
core.exportVariable("CAPSULE_LOG", "none")
|
core.exportVariable("CAPSULE_LOG", "none")
|
||||||
|
|
||||||
// Read in the arguments
|
// Read in the arguments
|
||||||
const token = core.getInput("token")
|
|
||||||
const version = core.getInput("version")
|
const version = core.getInput("version")
|
||||||
const get_all = core.getBooleanInput("all")
|
const get_all = core.getBooleanInput("all")
|
||||||
const cooldown = Number(core.getInput("cooldown"))
|
|
||||||
const max_retries = Number(core.getInput("max-retries"))
|
|
||||||
|
|
||||||
// Check the cache for the Nextflow version that matched last time
|
// Check the cache for the Nextflow version that matched last time
|
||||||
if (check_cache(version)) {
|
if (check_cache(version)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the API
|
|
||||||
const octokit = await setup_octokit(token, cooldown, max_retries)
|
|
||||||
|
|
||||||
// Get the release info for the desired release
|
// Get the release info for the desired release
|
||||||
let release = {} as NextflowRelease
|
let release = {} as NextflowRelease
|
||||||
let resolved_version = ""
|
let resolved_version = ""
|
||||||
try {
|
try {
|
||||||
if (version === "latest" || version === "latest-stable") {
|
if (version.includes("latest")) {
|
||||||
release = await pull_latest_stable_release(octokit)
|
let flavor = version.split("-")[1]
|
||||||
|
flavor = flavor ? flavor : "stable"
|
||||||
|
release = await get_latest_nextflow_version(flavor)
|
||||||
} else {
|
} else {
|
||||||
const release_iterator = pull_releases(octokit)
|
const nextflow_releases = await get_nextflow_versions()
|
||||||
release = await get_nextflow_release(version, release_iterator)
|
release = await get_nextflow_release(version, nextflow_releases)
|
||||||
}
|
}
|
||||||
resolved_version = release.version
|
resolved_version = release.version
|
||||||
core.info(
|
core.info(
|
||||||
|
|
Loading…
Reference in a new issue