Skip to content

Commit bfbc660

Browse files
mcargilleEndBug
andauthored
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>
1 parent 7ea5273 commit bfbc660

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

lib/index.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ core.info(`Running in ${baseDir}`)
3030

3131
core.info('> Checking for uncommitted changes in the git working tree...')
3232
const changedFiles = (await git.diffSummary(['--cached'])).files.length
33-
if (changedFiles > 0) {
33+
// continue if there are any changes or if the allow-empty commit argument is included
34+
if (changedFiles > 0 || matchGitArgs(getInput('commit') || '').includes('--allow-empty')) {
3435
core.info(`> Found ${changedFiles} changed files.`)
36+
core.debug(`--allow-empty argument detected: ${matchGitArgs(getInput('commit') || '').includes('--allow-empty')}`)
3537

3638
await git
3739
.addConfig('user.email', getInput('author_email'), undefined, log)

0 commit comments

Comments
 (0)