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:
mcargille
2022-01-23 17:05:54 -05:00
committed by GitHub
parent 7ea52730bc
commit bfbc660a1b
2 changed files with 5 additions and 3 deletions

4
lib/index.js generated

File diff suppressed because one or more lines are too long

View File

@@ -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)