Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.

Commit 608c16b

Browse files
authored
fix: stop providing default values in action.yml (#573)
* fix: stop providing default values in action.yml * fix: optional boolean parsing
1 parent b4c00f7 commit 608c16b

2 files changed

Lines changed: 29 additions & 26 deletions

File tree

action.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,19 +87,15 @@ inputs:
8787
monorepo-tags:
8888
description: 'add prefix to tags and branches, allowing multiple libraries to be released from the same repository'
8989
required: false
90-
default: false
9190
pull-request-title-pattern:
9291
description: 'add title pattern to make release PR, defaults to using "chore${scope}: release${component} ${version}"'
9392
required: false
94-
default: ''
9593
draft:
9694
description: 'mark release as a draft'
9795
required: false
98-
default: false
9996
draft-pull-request:
10097
description: 'mark pull request as a draft'
10198
required: false
102-
default: false
10399
changelog-notes-type:
104100
description: "Strategy for building the changelog contents(see https://github.com/googleapis/release-please/blob/main/docs/customizing.md#changelog-types). Default `default`. Called `changelog-type` in release-please documentation."
105101
required: false
@@ -112,18 +108,15 @@ inputs:
112108
skip-github-release:
113109
description: 'Skip creating GitHub Releases. Default `false`'
114110
required: false
115-
default: false
116111
prerelease:
117112
description: 'If set, create releases that are pre-major or pre-release version marked as pre-release on Github. Defaults `false`'
118113
required: false
119-
default: false
120114
component:
121115
description: 'name of the component used for branch naming and release tagging, defaults to a normalized version based on the package name'
122116
required: false
123117
include-v-in-tag:
124118
description: 'include "v" in tag versions. Default `true`'
125119
required: false
126-
default: true
127120
tag-separator:
128121
description: 'configures separator character used in release tag'
129122
required: false
@@ -139,11 +132,9 @@ inputs:
139132
always-link-local:
140133
description: 'when using the `node-workspace` plugin, setting to false will only bump your local dependencies within the SemVer range (see the manifest releaser docs)[https://github.com/googleapis/release-please/blob/main/docs/manifest-releaser.md) . Default `true`.'
141134
required: false
142-
default: true
143135
separate-pull-requests:
144136
description: 'create separate pull requests for each package instead of a single manifest release pull request (see the manifest releaser docs https://github.com/googleapis/release-please/blob/main/docs/manifest-releaser.md). Default `false`.'
145137
required: false
146-
default: false
147138
plugins:
148139
description: 'see https://github.com/googleapis/release-please/blob/main/docs/manifest-releaser.md#plugins'
149140
required: false
@@ -156,11 +147,9 @@ inputs:
156147
skip-labeling:
157148
description: 'if set, labels will not be applied to pull requests. Default `false`.'
158149
required: false
159-
default: false
160150
sequential-calls:
161151
description: 'issue GitHub API requests sequentially rather than concurrently (see the manifest releaser docs https://github.com/googleapis/release-please/blob/main/docs/manifest-releaser.md). Default `false`'
162152
required: false
163-
default: false
164153
group-pull-request-title-pattern:
165154
description: 'sets the manifest pull request title for when releasing multiple packages grouped together in the one pull request'
166155
required: false

index.js

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const signoff = core.getInput('signoff') || undefined
1414

1515
function getGitHubInput () {
1616
return {
17-
fork: core.getBooleanInput('fork'),
17+
fork: getOptionalBooleanInput('fork'),
1818
defaultBranch: core.getInput('default-branch') || undefined,
1919
repoUrl: core.getInput('repo-url') || process.env.GITHUB_REPOSITORY,
2020
apiUrl: core.getInput('github-api-url') || GITHUB_API_URL,
@@ -23,6 +23,20 @@ function getGitHubInput () {
2323
}
2424
}
2525

26+
function getOptionalBooleanInput (name) {
27+
if (core.getInput(name) === '') {
28+
return undefined
29+
}
30+
return core.getBooleanInput(name)
31+
}
32+
33+
function getOptionalMultilineInput (name) {
34+
if (core.getInput(name) === '') {
35+
return undefined
36+
}
37+
return core.getMultilineInput(name)
38+
}
39+
2640
function getManifestInput () {
2741
return {
2842
configFile: core.getInput('config-file') || CONFIG_FILE,
@@ -106,9 +120,9 @@ function getGitHubInstance () {
106120

107121
async function manifestInstance (github) {
108122
const { fork } = getGitHubInput()
109-
const bumpMinorPreMajor = core.getBooleanInput('bump-minor-pre-major')
110-
const bumpPatchForMinorPreMajor = core.getBooleanInput('bump-patch-for-minor-pre-major')
111-
const monorepoTags = core.getBooleanInput('monorepo-tags')
123+
const bumpMinorPreMajor = getOptionalBooleanInput('bump-minor-pre-major')
124+
const bumpPatchForMinorPreMajor = getOptionalBooleanInput('bump-patch-for-minor-pre-major')
125+
const monorepoTags = getOptionalBooleanInput('monorepo-tags')
112126
const packageName = core.getInput('package-name') || undefined
113127
const path = core.getInput('path') || undefined
114128
const releaseType = core.getInput('release-type', { required: true })
@@ -119,26 +133,26 @@ async function manifestInstance (github) {
119133
const versionFile = core.getInput('version-file') || undefined
120134
const extraFiles = core.getMultilineInput('extra-files') || undefined
121135
const pullRequestTitlePattern = core.getInput('pull-request-title-pattern') || undefined
122-
const draft = core.getBooleanInput('draft')
123-
const draftPullRequest = core.getBooleanInput('draft-pull-request')
136+
const draft = getOptionalBooleanInput('draft')
137+
const draftPullRequest = getOptionalBooleanInput('draft-pull-request')
124138
const changelogType = core.getInput('changelog-notes-type') || undefined
125139
const versioning = core.getInput('versioning-strategy') || undefined
126140
const releaseAs = core.getInput('release-as') || undefined
127-
const skipGithubRelease = core.getBooleanInput('skip-github-release')
128-
const prerelease = core.getBooleanInput('prerelease')
141+
const skipGithubRelease = getOptionalBooleanInput('skip-github-release')
142+
const prerelease = getOptionalBooleanInput('prerelease')
129143
const component = core.getInput('component') || undefined
130-
const includeVInTag = core.getBooleanInput('include-v-in-tag')
144+
const includeVInTag = getOptionalBooleanInput('include-v-in-tag')
131145
const tagSeparator = core.getInput('tag-separator') || undefined
132-
const snapshotLabels = core.getInput('snapshot-labels') ? core.getMultilineInput('snapshot-labels') : undefined
146+
const snapshotLabels = getOptionalMultilineInput('snapshot-labels')
133147
const bootstrapSha = core.getInput('bootstrap-sha') || undefined
134148
const lastReleaseSha = core.getInput('last-release-sha') || undefined
135-
const alwaysLinkLocal = core.getBooleanInput('always-link-local')
136-
const separatePullRequests = core.getBooleanInput('separate-pull-requests')
149+
const alwaysLinkLocal = getOptionalBooleanInput('always-link-local')
150+
const separatePullRequests = getOptionalBooleanInput('separate-pull-requests')
137151
const plugins = core.getMultilineInput('plugins') || undefined
138152
const labels = core.getInput('labels') ? core.getMultilineInput('labels') : undefined
139-
const releaseLabels = core.getInput('release-labels') ? core.getMultilineInput('release-labels') : undefined
140-
const skipLabeling = core.getBooleanInput('skip-labeling')
141-
const sequentialCalls = core.getBooleanInput('sequential-calls')
153+
const releaseLabels = getOptionalMultilineInput('release-labels')
154+
const skipLabeling = getOptionalBooleanInput('skip-labeling')
155+
const sequentialCalls = getOptionalBooleanInput('sequential-calls')
142156
const groupPullRequestTitlePattern = core.getInput('group-pull-request-title-pattern') || undefined
143157
const releaseSearchDepth = core.getInput('release-search-depth') || undefined
144158
const commitSearchDepth = core.getInput('commit-search-depth') || undefined

0 commit comments

Comments
 (0)