mirror of
https://github.com/MillironX/setup-nextflow.git
synced 2024-11-21 09:26:04 +00:00
chore: Clean up a bunch of object references
https://medium.com/@kgdilipchandana/how-to-solve-error-ts2339-property-label-does-not-exist-on-type-in-angular-5-db01843ef6a
This commit is contained in:
parent
955a936296
commit
7a0ec2a9b4
3 changed files with 20 additions and 15 deletions
|
@ -35,7 +35,7 @@ export async function release_data(
|
|||
): Promise<object> {
|
||||
// Setup tag-based filtering
|
||||
let filter = (r: object): boolean => {
|
||||
return semver.satisfies(r.tag_name, version, true)
|
||||
return semver.satisfies(r['tag_name'], version, true)
|
||||
}
|
||||
|
||||
// Check if the user passed a 'latest*' tag, and override filtering
|
||||
|
@ -49,7 +49,7 @@ export async function release_data(
|
|||
}
|
||||
} else if (version.includes('-edge')) {
|
||||
filter = r => {
|
||||
return r.tag_name.endsWith('-edge')
|
||||
return r['tag_name'].endsWith('-edge')
|
||||
}
|
||||
} else {
|
||||
// This is special: passing 'latest' or 'latest-stable' allows us to use
|
||||
|
@ -62,6 +62,7 @@ export async function release_data(
|
|||
// Get all the releases
|
||||
const all_releases = await all_nf_releases(ok)
|
||||
|
||||
// FIXME Ignore
|
||||
const matching_releases = all_releases.filter(filter)
|
||||
|
||||
matching_releases.sort(function (x, y) {
|
||||
|
@ -71,13 +72,13 @@ export async function release_data(
|
|||
return matching_releases[0]
|
||||
}
|
||||
|
||||
export function nextflow_bin_url(release, get_all: boolean): string {
|
||||
const release_assets = release.assets
|
||||
const all_asset = release_assets.filter(a => {
|
||||
return a.browser_download_url.endsWith('-all')
|
||||
export function nextflow_bin_url(release: object, get_all: boolean): string {
|
||||
const release_assets = release['assets']
|
||||
const all_asset = release_assets.filter((a: object) => {
|
||||
return a['browser_download_url'].endsWith('-all')
|
||||
})[0]
|
||||
const regular_asset = release_assets.filter(a => {
|
||||
return a.name === 'nextflow'
|
||||
const regular_asset = release_assets.filter((a: object) => {
|
||||
return a['name'] === 'nextflow'
|
||||
})[0]
|
||||
|
||||
const dl_asset = get_all ? all_asset : regular_asset
|
||||
|
|
|
@ -32,8 +32,10 @@ async function run(): Promise<void> {
|
|||
let release = {}
|
||||
try {
|
||||
release = await release_data(version, octokit)
|
||||
resolved_version = release.tag_name
|
||||
core.info(`Input version '${version}' resolved to Nextflow ${release.name}`)
|
||||
resolved_version = release['tag_name']
|
||||
core.info(
|
||||
`Input version '${version}' resolved to Nextflow ${release['name']}`
|
||||
)
|
||||
} catch (e: unknown) {
|
||||
if (e instanceof Error) {
|
||||
core.setFailed(
|
||||
|
|
|
@ -12,19 +12,21 @@ test.before(t => {
|
|||
})
|
||||
|
||||
test('all_nf_releases', async t => {
|
||||
const result = await functions.all_nf_releases(t.context.octokit)
|
||||
const result = await functions.all_nf_releases(t.context['octokit'])
|
||||
t.is(typeof result, 'object')
|
||||
})
|
||||
|
||||
test('lastest_stable_release_data', async t => {
|
||||
const result = await functions.latest_stable_release_data(t.context.octokit)
|
||||
const result = await functions.latest_stable_release_data(
|
||||
t.context['octokit']
|
||||
)
|
||||
t.is(typeof result, 'object')
|
||||
t.is(result.tag_name, 'v22.10.2')
|
||||
t.is(result['tag_name'], 'v22.10.2')
|
||||
})
|
||||
|
||||
test('release_data', async t => {
|
||||
const result = await functions.release_data('v22.10.2', t.context.octokit)
|
||||
t.is(result.tag_name, 'v22.10.2')
|
||||
const result = await functions.release_data('v22.10.2', t.context['octokit'])
|
||||
t.is(result['tag_name'], 'v22.10.2')
|
||||
})
|
||||
|
||||
test.todo('nextflow_bin_url')
|
||||
|
|
Loading…
Reference in a new issue