Skip to content

Commit 0b47528

Browse files
authored
fix!: fail when there's an error while committing (#376)
1 parent a3279e7 commit 0b47528

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

lib/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,18 @@ core.info(`Running in ${baseDir}`)
7979
} else core.info('> Not pulling from repo.')
8080

8181
core.info('> Creating commit...')
82-
const commitData = await git
82+
await git
8383
.commit(getInput('message'), matchGitArgs(getInput('commit') || ''))
84-
.catch((err) => {
85-
log(err)
84+
.then(async (data) => {
85+
log(undefined, data)
86+
setOutput('committed', 'true')
87+
setOutput('commit_sha', data.commit)
88+
await git
89+
.revparse(data.commit)
90+
.then((long_sha) => setOutput('commit_long_sha', long_sha))
91+
.catch((err) => core.warning(`Couldn't parse long SHA:\n${err}`))
8692
})
87-
if (commitData) {
88-
log(undefined, commitData)
89-
setOutput('committed', 'true')
90-
setOutput('commit_sha', commitData.commit)
91-
await git
92-
.revparse(commitData.commit)
93-
.then((long_sha) => setOutput('commit_long_sha', long_sha))
94-
.catch((err) => core.warning(`Couldn't parse long SHA:\n${err}`))
95-
}
93+
.catch((err) => core.setFailed(err))
9694

9795
if (getInput('tag')) {
9896
core.info('> Tagging commit...')

0 commit comments

Comments
 (0)