fix: add check to allow empty commits (#352)
* add check to allow empty commits if arg is set * fix: target only the desired argument * fix: add debug message * fix: fix debug message Co-authored-by: Federico Grandi <fgrandi30@gmail.com>
This commit is contained in:
4
lib/index.js
generated
4
lib/index.js
generated
File diff suppressed because one or more lines are too long
@@ -30,8 +30,10 @@ core.info(`Running in ${baseDir}`)
|
||||
|
||||
core.info('> Checking for uncommitted changes in the git working tree...')
|
||||
const changedFiles = (await git.diffSummary(['--cached'])).files.length
|
||||
if (changedFiles > 0) {
|
||||
// continue if there are any changes or if the allow-empty commit argument is included
|
||||
if (changedFiles > 0 || matchGitArgs(getInput('commit') || '').includes('--allow-empty')) {
|
||||
core.info(`> Found ${changedFiles} changed files.`)
|
||||
core.debug(`--allow-empty argument detected: ${matchGitArgs(getInput('commit') || '').includes('--allow-empty')}`)
|
||||
|
||||
await git
|
||||
.addConfig('user.email', getInput('author_email'), undefined, log)
|
||||
|
||||
Reference in New Issue
Block a user