Skip to content

Commit

Permalink
fix: add check to allow empty commits (#352)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
mcargille and EndBug committed Jan 23, 2022
1 parent 7ea5273 commit bfbc660
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/index.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion src/main.ts
Expand Up @@ -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)
Expand Down

0 comments on commit bfbc660

Please sign in to comment.