chore(deps): bump @actions/core from 1.2.7 to 1.3.0 (#203)

* chore(deps): bump @actions/core from 1.2.7 to 1.3.0

Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.2.7 to 1.3.0.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

Signed-off-by: dependabot[bot] <support@github.com>

* feat: switch to YAML boolean for inputs

The parsing is now handled by `@actions/core` package

* docs(README): minor changes

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Federico Grandi <fgrandi30@gmail.com>
This commit is contained in:
dependabot[bot]
2021-05-24 16:45:13 +02:00
committed by GitHub
parent bf5e32ae7d
commit b2ad943ed9
7 changed files with 40 additions and 35 deletions

View File

@@ -9,7 +9,6 @@ import {
log,
matchGitArgs,
outputs,
parseBool,
readJSON,
setOutput
} from './util'
@@ -105,7 +104,12 @@ core.info(`Running in ${baseDir}`)
.catch((err) => core.setFailed(err))
} else core.info('> No tag info provided.')
const pushOption = parseBool(getInput('push')) ?? getInput('push')
let pushOption: string | boolean
try {
pushOption = getInput('push', true)
} catch {
pushOption = getInput('push')
}
if (pushOption) {
// If the options is `true | string`...
core.info('> Pushing commit to repo...')
@@ -301,7 +305,7 @@ async function checkInputs() {
// #region signoff
if (getInput('signoff')) {
const parsed = parseBool(getInput('signoff'))
const parsed = getInput('signoff', true)
if (parsed === undefined)
throw new Error(
@@ -328,11 +332,15 @@ async function checkInputs() {
// #region push
if (getInput('push')) {
// It has to be either 'true', 'false', or any other string (use as arguments)
const parsed = parseBool(getInput('push'))
let value: string | boolean
core.debug(
`Current push option: '${getInput('push')}' (parsed as ${typeof parsed})`
)
try {
value = getInput('push', true)
} catch {
value = getInput('push')
}
core.debug(`Current push option: '${value}' (parsed as ${typeof value})`)
}
// #endregion

View File

@@ -35,7 +35,10 @@ export const outputs: Record<Output, 'true' | 'false'> = {
tagged: 'false'
}
export function getInput(name: Input) {
export function getInput(name: Input, bool: true): boolean
export function getInput(name: Input, bool?: false): string
export function getInput(name: Input, bool = false) {
if (bool) return core.getBooleanInput(name)
return tools.inputs[name] || ''
}
@@ -92,13 +95,6 @@ export function matchGitArgs(string: string) {
return parsed
}
export function parseBool(value: any) {
try {
const parsed = JSON.parse(value)
if (typeof parsed == 'boolean') return parsed
} catch {}
}
export function readJSON(filePath: string) {
let fileContent: string
try {