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:
parent
101b6de688
commit
ecb6e7837c
1 changed files with 6 additions and 2 deletions
8
index.js
8
index.js
|
|
@ -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']);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue