Refactor setting commit params
This commit is contained in:
parent
ee482f51bd
commit
ba8309ff9c
2 changed files with 10 additions and 11 deletions
13
dist/index.js
vendored
13
dist/index.js
vendored
|
@ -1077,12 +1077,11 @@ function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName
|
||||||
if (yield git.isDirty(true)) {
|
if (yield git.isDirty(true)) {
|
||||||
core.info('Uncommitted changes found. Adding a commit.');
|
core.info('Uncommitted changes found. Adding a commit.');
|
||||||
yield git.exec(['add', '-A']);
|
yield git.exec(['add', '-A']);
|
||||||
if (signoff == true) {
|
const params = ['-m', commitMessage];
|
||||||
yield git.commit(['-m', commitMessage, '-s']);
|
if (signoff) {
|
||||||
}
|
params.push('--signoff');
|
||||||
else {
|
|
||||||
yield git.commit(['-m', commitMessage]);
|
|
||||||
}
|
}
|
||||||
|
yield git.commit(params);
|
||||||
}
|
}
|
||||||
// Perform fetch and reset the working base
|
// Perform fetch and reset the working base
|
||||||
// Commits made during the workflow will be removed
|
// Commits made during the workflow will be removed
|
||||||
|
@ -1301,6 +1300,7 @@ function run() {
|
||||||
commitMessage: core.getInput('commit-message'),
|
commitMessage: core.getInput('commit-message'),
|
||||||
committer: core.getInput('committer'),
|
committer: core.getInput('committer'),
|
||||||
author: core.getInput('author'),
|
author: core.getInput('author'),
|
||||||
|
signoff: core.getInput('signoff') === 'true',
|
||||||
branch: core.getInput('branch'),
|
branch: core.getInput('branch'),
|
||||||
branchSuffix: core.getInput('branch-suffix'),
|
branchSuffix: core.getInput('branch-suffix'),
|
||||||
base: core.getInput('base'),
|
base: core.getInput('base'),
|
||||||
|
@ -1312,8 +1312,7 @@ function run() {
|
||||||
reviewers: utils.getInputAsArray('reviewers'),
|
reviewers: utils.getInputAsArray('reviewers'),
|
||||||
teamReviewers: utils.getInputAsArray('team-reviewers'),
|
teamReviewers: utils.getInputAsArray('team-reviewers'),
|
||||||
milestone: Number(core.getInput('milestone')),
|
milestone: Number(core.getInput('milestone')),
|
||||||
draft: core.getInput('draft') === 'true',
|
draft: core.getInput('draft') === 'true'
|
||||||
signoff: core.getInput('signoff') === 'true'
|
|
||||||
};
|
};
|
||||||
core.debug(`Inputs: ${util_1.inspect(inputs)}`);
|
core.debug(`Inputs: ${util_1.inspect(inputs)}`);
|
||||||
yield create_pull_request_1.createPullRequest(inputs);
|
yield create_pull_request_1.createPullRequest(inputs);
|
||||||
|
|
|
@ -100,11 +100,11 @@ export async function createOrUpdateBranch(
|
||||||
if (await git.isDirty(true)) {
|
if (await git.isDirty(true)) {
|
||||||
core.info('Uncommitted changes found. Adding a commit.')
|
core.info('Uncommitted changes found. Adding a commit.')
|
||||||
await git.exec(['add', '-A'])
|
await git.exec(['add', '-A'])
|
||||||
if (signoff == true) {
|
const params = ['-m', commitMessage]
|
||||||
await git.commit(['-m', commitMessage, '-s'])
|
if (signoff) {
|
||||||
} else {
|
params.push('--signoff')
|
||||||
await git.commit(['-m', commitMessage])
|
|
||||||
}
|
}
|
||||||
|
await git.commit(params)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Perform fetch and reset the working base
|
// Perform fetch and reset the working base
|
||||||
|
|
Loading…
Reference in a new issue