Skip to content

Commit

Permalink
feat!: add commit input (#331)
Browse files Browse the repository at this point in the history
* fix!: remove `signoff` input

* feat: add `commit` input
  • Loading branch information
EndBug committed Dec 3, 2021
1 parent b1323b2 commit 7392614
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 38 deletions.
4 changes: 0 additions & 4 deletions README.md
Expand Up @@ -77,10 +77,6 @@ Add a step like this to your workflow:
# Default: ''
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)
# Default: ''
tag: 'v1.0.0 --force'
Expand Down
6 changes: 3 additions & 3 deletions action.yml
Expand Up @@ -19,6 +19,9 @@ inputs:
description: How the action should behave when the targeted branch is missing
required: false
default: throw
commit:
description: Additional arguments for the git commit command
required: false
committer_name:
description: The name of the custom committer you want to use
required: false
Expand Down Expand Up @@ -56,9 +59,6 @@ inputs:
remove:
description: Arguments for the git rm command
required: false
signoff:
description: Whether to use the --signoff option on git commit
required: false
tag:
description: Arguments for the git tag command (the tag name always needs to be the first word not preceded by a hyphen)
required: false
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js

Large diffs are not rendered by default.

30 changes: 1 addition & 29 deletions src/main.ts
Expand Up @@ -97,14 +97,7 @@ core.info(`Running in ${baseDir}`)
core.info('> Creating commit...')
await git.commit(
getInput('message'),
undefined,
{
...(getInput('signoff')
? {
'--signoff': null
}
: {})
},
matchGitArgs(getInput('commit') || ''),
(err, data?: CommitSummary) => {
if (data) {
setOutput('committed', 'true')
Expand Down Expand Up @@ -404,27 +397,6 @@ async function checkInputs() {
}
// #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
if (!getInput('github_token'))
core.warning(
Expand Down
2 changes: 1 addition & 1 deletion src/util.ts
Expand Up @@ -9,6 +9,7 @@ interface InputTypes {
author_email: string
branch: string
branch_mode: 'throw' | 'create'
commit: string | undefined
committer_name: string
committer_email: string
cwd: string
Expand All @@ -19,7 +20,6 @@ interface InputTypes {
pull_strategy: string | undefined
push: string
remove: string | undefined
signoff: undefined
tag: string | undefined

github_token: string | undefined
Expand Down

0 comments on commit 7392614

Please sign in to comment.