Skip to content

Commit

Permalink
fix: release-tags typo
Browse files Browse the repository at this point in the history
  • Loading branch information
peam1146 committed Aug 16, 2024
1 parent 5f69232 commit 985ae4d
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 21 deletions.
43 changes: 33 additions & 10 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

32 changes: 24 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,28 @@ import { releaseMode } from './main'
import * as core from '@actions/core'

// eslint-disable-next-line @typescript-eslint/no-floating-promises
const mode = core.getInput('mode')
switch (mode) {
case 'release':
releaseMode()
break
default:
core.setFailed(`Unknown mode: ${mode}`)
break
async function run() {

Check failure on line 8 in src/index.ts

View workflow job for this annotation

GitHub Actions / TypeScript Tests

Missing return type on function

Check failure on line 8 in src/index.ts

View workflow job for this annotation

GitHub Actions / Lint Codebase

Missing return type on function
const mode = core.getInput('mode')
const maxAttempts = parseInt(core.getInput('max-attempts'))
let attempt = maxAttempts
while (attempt--) {
if (attempt < maxAttempts - 1) {
core.info(`Retrying in 5 seconds...`)
await new Promise(resolve => setTimeout(resolve, 5000))
}
try {
switch (mode) {
case 'release':
releaseMode()
break
default:
core.setFailed(`Unknown mode: ${mode}`)
return
}
} catch (error: any) {

Check failure on line 26 in src/index.ts

View workflow job for this annotation

GitHub Actions / TypeScript Tests

Unexpected any. Specify a different type

Check failure on line 26 in src/index.ts

View workflow job for this annotation

GitHub Actions / Lint Codebase

Unexpected any. Specify a different type
core.error(error)
}
}
}

run()
12 changes: 10 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,24 @@ export function parseIssueFromReleaseBody(
}

export async function releaseMode(): Promise<void> {
const releasesTags = core.getInput('releases-tags', { trimWhitespace: true })
const releasesTags = core.getInput('release-tags', { trimWhitespace: true })
core.debug(`Release tags: ${releasesTags}`)
const parsedReleaseTags = parseReleaseTags(releasesTags)

core.debug(`Parsed release tags: ${parsedReleaseTags}`)

if (!parsedReleaseTags.length) {
core.info('No releases to fetch')
return
}

const octokit = new Octokit({ auth: core.getInput('token') })
const { results, errors } = await PromisePool.withConcurrency(2)
.for(parsedReleaseTags)
.process(async tag => {
const release = octokit.rest.repos.getReleaseByTag({
owner: core.getInput('owner'),
repo: core.getInput('repo'),
repo: core.getInput('repo').split('/')[1],
tag
})
core.debug(`Fetched release: ${tag}`)
Expand All @@ -59,6 +64,9 @@ export async function releaseMode(): Promise<void> {

if (errors.length) {
core.setFailed(`Failed to fetch releases: ${errors.length}`)
for (const error of errors) {
core.error(error)
}
return
}

Expand Down

0 comments on commit 985ae4d

Please sign in to comment.