mirror of
https://github.com/joaquinjsb/gitea-release-please-action
synced 2026-05-12 11:31:33 +02:00
fix: get the correct boolean value of the input (#233)
This commit is contained in:
43
index.js
43
index.js
@@ -5,25 +5,29 @@ const RELEASE_LABEL = 'autorelease: pending'
|
||||
const GITHUB_RELEASE_COMMAND = 'github-release'
|
||||
const GITHUB_RELEASE_PR_COMMAND = 'release-pr'
|
||||
|
||||
async function main () {
|
||||
const bumpMinorPreMajor = Boolean(core.getInput('bump-minor-pre-major'))
|
||||
const monorepoTags = Boolean(core.getInput('monorepo-tags'))
|
||||
const packageName = core.getInput('package-name')
|
||||
const path = core.getInput('path') ? core.getInput('path') : undefined
|
||||
const releaseType = core.getInput('release-type')
|
||||
const token = core.getInput('token')
|
||||
const fork = core.getInput('fork') ? true : undefined
|
||||
const changelogPath = core.getInput('changelog-path') ? core.getInput('changelog-path') : undefined
|
||||
const changelogTypes = core.getInput('changelog-types')
|
||||
const command = core.getInput('command') ? core.getInput('command') : undefined
|
||||
const versionFile = core.getInput('version-file') ? core.getInput('version-file') : undefined
|
||||
const defaultBranch = core.getInput('default-branch') ? core.getInput('default-branch') : undefined
|
||||
function getBooleanInput (input) {
|
||||
const trueValue = ['true', 'True', 'TRUE', 'yes', 'Yes', 'YES', 'y', 'Y', 'on', 'On', 'ON']
|
||||
const falseValue = ['false', 'False', 'FALSE', 'no', 'No', 'NO', 'n', 'N', 'off', 'Off', 'OFF']
|
||||
const stringInput = core.getInput(input)
|
||||
if (trueValue.indexOf(stringInput) > -1) return true
|
||||
if (falseValue.indexOf(stringInput) > -1) return false
|
||||
throw TypeError(`Wrong boolean value of the input '${input}'`)
|
||||
}
|
||||
|
||||
// Parse the changelogTypes if there are any
|
||||
let changelogSections
|
||||
if (changelogTypes) {
|
||||
changelogSections = JSON.parse(changelogTypes)
|
||||
}
|
||||
async function main () {
|
||||
const bumpMinorPreMajor = getBooleanInput('bump-minor-pre-major')
|
||||
const monorepoTags = getBooleanInput('monorepo-tags')
|
||||
const packageName = core.getInput('package-name', { required: true })
|
||||
const path = core.getInput('path') || undefined
|
||||
const releaseType = core.getInput('release-type', { required: true })
|
||||
const token = core.getInput('token', { required: true })
|
||||
const fork = getBooleanInput('fork')
|
||||
const changelogPath = core.getInput('changelog-path') || undefined
|
||||
const changelogTypes = core.getInput('changelog-types')
|
||||
const changelogSections = changelogTypes && JSON.parse(changelogTypes)
|
||||
const command = core.getInput('command') || undefined
|
||||
const versionFile = core.getInput('version-file') || undefined
|
||||
const defaultBranch = core.getInput('default-branch') || undefined
|
||||
|
||||
// First we check for any merged release PRs (PRs merged with the label
|
||||
// "autorelease: pending"):
|
||||
@@ -74,7 +78,8 @@ async function main () {
|
||||
}
|
||||
|
||||
const releasePlease = {
|
||||
main
|
||||
main,
|
||||
getBooleanInput
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
|
||||
Reference in New Issue
Block a user