|
1 | 1 | import * as core from '@actions/core' |
2 | 2 | import path from 'path' |
3 | | -import simpleGit, { CommitSummary, Response } from 'simple-git' |
| 3 | +import simpleGit, { Response } from 'simple-git' |
4 | 4 | import { checkInputs, getInput, logOutputs, setOutput } from './io' |
5 | 5 | import { log, matchGitArgs, parseInputArray } from './util' |
6 | 6 |
|
@@ -70,17 +70,20 @@ core.info(`Running in ${baseDir}`) |
70 | 70 | } else core.info('> Not pulling from repo.') |
71 | 71 |
|
72 | 72 | core.info('> Creating commit...') |
73 | | - await git.commit( |
74 | | - getInput('message'), |
75 | | - matchGitArgs(getInput('commit') || ''), |
76 | | - (err, data?: CommitSummary) => { |
77 | | - if (data) { |
78 | | - setOutput('committed', 'true') |
79 | | - setOutput('commit_sha', data.commit) |
80 | | - } |
81 | | - return log(err, data) |
82 | | - } |
83 | | - ) |
| 73 | + const commitData = await git |
| 74 | + .commit(getInput('message'), matchGitArgs(getInput('commit') || '')) |
| 75 | + .catch((err) => { |
| 76 | + log(err) |
| 77 | + }) |
| 78 | + if (commitData) { |
| 79 | + log(undefined, commitData) |
| 80 | + setOutput('committed', 'true') |
| 81 | + setOutput('commit_sha', commitData.commit) |
| 82 | + await git |
| 83 | + .revparse(commitData.commit) |
| 84 | + .then((long_sha) => setOutput('commit_long_sha', long_sha)) |
| 85 | + .catch((err) => core.warning(`Couldn't parse long SHA:\n${err}`)) |
| 86 | + } |
84 | 87 |
|
85 | 88 | if (getInput('tag')) { |
86 | 89 | core.info('> Tagging commit...') |
|
0 commit comments