5
0
Fork 0
mirror of https://github.com/pre-commit/action.git synced 2025-11-09 03:26:56 +00:00

fix: add a space between the commit prefix and the message

This commit is contained in:
cdrx 2020-12-04 11:48:34 +00:00
parent 101b6de688
commit ecb6e7837c

View file

@ -53,11 +53,15 @@ async function main() {
const cacheKey = `pre-commit-2-${hashString(py)}-${hashFile('.pre-commit-config.yaml')}`; const cacheKey = `pre-commit-2-${hashString(py)}-${hashFile('.pre-commit-config.yaml')}`;
const restored = await cache.restoreCache(cachePaths, cacheKey); const restored = await cache.restoreCache(cachePaths, cacheKey);
const ret = await exec.exec('pre-commit', args, {ignoreReturnCode: push}); const ret = await exec.exec('pre-commit', args, {ignoreReturnCode: push});
const commitMessage = core.getInput('commit_message'); let commitMessage = core.getInput('commit_message');
const commitPrefix = core.getInput('commit_prefix'); const commitPrefix = core.getInput('commit_prefix');
const committerEmail = core.getInput('committer_email'); const committerEmail = core.getInput('committer_email');
const committerName = core.getInput('committer_name'); const committerName = core.getInput('committer_name');
if (commitPrefix) {
commitMessage = commitPrefix + ' ' + commitMessage;
}
if (!restored) { if (!restored) {
await cache.saveCache(cachePaths, cacheKey); await cache.saveCache(cachePaths, cacheKey);
} }
@ -81,7 +85,7 @@ async function main() {
const branch = pr.head.ref; const branch = pr.head.ref;
await exec.exec('git', ['checkout', 'HEAD', '-b', branch]); await exec.exec('git', ['checkout', 'HEAD', '-b', branch]);
await exec.exec('git', ['commit', '-am', commitPrefix + commitMessage]); await exec.exec('git', ['commit', '-am', commitMessage]);
const url = addToken(pr.head.repo.clone_url, token); const url = addToken(pr.head.repo.clone_url, token);
await exec.exec('git', ['push', url, 'HEAD']); await exec.exec('git', ['push', url, 'HEAD']);
}); });