Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: fail when there's an error while committing #376

Merged
merged 1 commit into from Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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