feat!: add commit input (#331)
* fix!: remove `signoff` input * feat: add `commit` input
This commit is contained in:
@@ -77,10 +77,6 @@ Add a step like this to your workflow:
|
|||||||
# Default: ''
|
# Default: ''
|
||||||
remove: './dir/old_file.js'
|
remove: './dir/old_file.js'
|
||||||
|
|
||||||
# Whether to use the --signoff option on `git commit` (only boolean values accepted*)
|
|
||||||
# Default: false
|
|
||||||
signoff: true
|
|
||||||
|
|
||||||
# Arguments for the git tag command (the tag name always needs to be the first word not preceded by an hyphen)
|
# Arguments for the git tag command (the tag name always needs to be the first word not preceded by an hyphen)
|
||||||
# Default: ''
|
# Default: ''
|
||||||
tag: 'v1.0.0 --force'
|
tag: 'v1.0.0 --force'
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ inputs:
|
|||||||
description: How the action should behave when the targeted branch is missing
|
description: How the action should behave when the targeted branch is missing
|
||||||
required: false
|
required: false
|
||||||
default: throw
|
default: throw
|
||||||
|
commit:
|
||||||
|
description: Additional arguments for the git commit command
|
||||||
|
required: false
|
||||||
committer_name:
|
committer_name:
|
||||||
description: The name of the custom committer you want to use
|
description: The name of the custom committer you want to use
|
||||||
required: false
|
required: false
|
||||||
@@ -56,9 +59,6 @@ inputs:
|
|||||||
remove:
|
remove:
|
||||||
description: Arguments for the git rm command
|
description: Arguments for the git rm command
|
||||||
required: false
|
required: false
|
||||||
signoff:
|
|
||||||
description: Whether to use the --signoff option on git commit
|
|
||||||
required: false
|
|
||||||
tag:
|
tag:
|
||||||
description: Arguments for the git tag command (the tag name always needs to be the first word not preceded by a hyphen)
|
description: Arguments for the git tag command (the tag name always needs to be the first word not preceded by a hyphen)
|
||||||
required: false
|
required: false
|
||||||
|
|||||||
2
lib/index.js
generated
2
lib/index.js
generated
File diff suppressed because one or more lines are too long
30
src/main.ts
30
src/main.ts
@@ -97,14 +97,7 @@ core.info(`Running in ${baseDir}`)
|
|||||||
core.info('> Creating commit...')
|
core.info('> Creating commit...')
|
||||||
await git.commit(
|
await git.commit(
|
||||||
getInput('message'),
|
getInput('message'),
|
||||||
undefined,
|
matchGitArgs(getInput('commit') || ''),
|
||||||
{
|
|
||||||
...(getInput('signoff')
|
|
||||||
? {
|
|
||||||
'--signoff': null
|
|
||||||
}
|
|
||||||
: {})
|
|
||||||
},
|
|
||||||
(err, data?: CommitSummary) => {
|
(err, data?: CommitSummary) => {
|
||||||
if (data) {
|
if (data) {
|
||||||
setOutput('committed', 'true')
|
setOutput('committed', 'true')
|
||||||
@@ -404,27 +397,6 @@ async function checkInputs() {
|
|||||||
}
|
}
|
||||||
// #endregion
|
// #endregion
|
||||||
|
|
||||||
// #region signoff
|
|
||||||
if (getInput('signoff')) {
|
|
||||||
const parsed = getInput('signoff', true)
|
|
||||||
|
|
||||||
if (parsed === undefined)
|
|
||||||
throw new Error(
|
|
||||||
`"${getInput(
|
|
||||||
'signoff'
|
|
||||||
)}" is not a valid value for the 'signoff' input: only "true" and "false" are allowed.`
|
|
||||||
)
|
|
||||||
|
|
||||||
if (!parsed) setInput('signoff', undefined)
|
|
||||||
|
|
||||||
core.debug(
|
|
||||||
`Current signoff option: ${getInput('signoff')} (${typeof getInput(
|
|
||||||
'signoff'
|
|
||||||
)})`
|
|
||||||
)
|
|
||||||
}
|
|
||||||
// #endregion
|
|
||||||
|
|
||||||
// #region github_token
|
// #region github_token
|
||||||
if (!getInput('github_token'))
|
if (!getInput('github_token'))
|
||||||
core.warning(
|
core.warning(
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ interface InputTypes {
|
|||||||
author_email: string
|
author_email: string
|
||||||
branch: string
|
branch: string
|
||||||
branch_mode: 'throw' | 'create'
|
branch_mode: 'throw' | 'create'
|
||||||
|
commit: string | undefined
|
||||||
committer_name: string
|
committer_name: string
|
||||||
committer_email: string
|
committer_email: string
|
||||||
cwd: string
|
cwd: string
|
||||||
@@ -19,7 +20,6 @@ interface InputTypes {
|
|||||||
pull_strategy: string | undefined
|
pull_strategy: string | undefined
|
||||||
push: string
|
push: string
|
||||||
remove: string | undefined
|
remove: string | undefined
|
||||||
signoff: undefined
|
|
||||||
tag: string | undefined
|
tag: string | undefined
|
||||||
|
|
||||||
github_token: string | undefined
|
github_token: string | undefined
|
||||||
|
|||||||
Reference in New Issue
Block a user