Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: add commit input #331

Merged
merged 2 commits into from Dec 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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