Skip to content

Commit

Permalink
fix!: fail when there's an error while committing (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
EndBug authored Mar 11, 2022
1 parent a3279e7 commit 0b47528
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lib/index.js

Large diffs are not rendered by default.

22 changes: 10 additions & 12 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,18 @@ core.info(`Running in ${baseDir}`)
} else core.info('> Not pulling from repo.')

core.info('> Creating commit...')
const commitData = await git
await git
.commit(getInput('message'), matchGitArgs(getInput('commit') || ''))
.catch((err) => {
log(err)
.then(async (data) => {
log(undefined, data)
setOutput('committed', 'true')
setOutput('commit_sha', data.commit)
await git
.revparse(data.commit)
.then((long_sha) => setOutput('commit_long_sha', long_sha))
.catch((err) => core.warning(`Couldn't parse long SHA:\n${err}`))
})
if (commitData) {
log(undefined, commitData)
setOutput('committed', 'true')
setOutput('commit_sha', commitData.commit)
await git
.revparse(commitData.commit)
.then((long_sha) => setOutput('commit_long_sha', long_sha))
.catch((err) => core.warning(`Couldn't parse long SHA:\n${err}`))
}
.catch((err) => core.setFailed(err))

if (getInput('tag')) {
core.info('> Tagging commit...')
Expand Down

0 comments on commit 0b47528

Please sign in to comment.