From ecb6e7837ca6e46fcd54ad7c0230531758270f59 Mon Sep 17 00:00:00 2001 From: cdrx Date: Fri, 4 Dec 2020 11:48:34 +0000 Subject: [PATCH] fix: add a space between the commit prefix and the message --- index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 670611d..993550d 100644 --- a/index.js +++ b/index.js @@ -53,11 +53,15 @@ async function main() { const cacheKey = `pre-commit-2-${hashString(py)}-${hashFile('.pre-commit-config.yaml')}`; const restored = await cache.restoreCache(cachePaths, cacheKey); 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 committerEmail = core.getInput('committer_email'); const committerName = core.getInput('committer_name'); + if (commitPrefix) { + commitMessage = commitPrefix + ' ' + commitMessage; + } + if (!restored) { await cache.saveCache(cachePaths, cacheKey); } @@ -81,7 +85,7 @@ async function main() { const branch = pr.head.ref; 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); await exec.exec('git', ['push', url, 'HEAD']); });