mirror of
https://forgejo.stefka.eu/jiriks74/create-pull-request.git
synced 2025-01-18 16:01:06 +01:00
[CI] test committed
This commit is contained in:
parent
4b53b6fd1a
commit
f13f2d0052
3 changed files with 17 additions and 3 deletions
|
@ -8,6 +8,13 @@ inputs:
|
||||||
description: >
|
description: >
|
||||||
Relative path under $GITHUB_WORKSPACE to the repository.
|
Relative path under $GITHUB_WORKSPACE to the repository.
|
||||||
Defaults to $GITHUB_WORKSPACE.
|
Defaults to $GITHUB_WORKSPACE.
|
||||||
|
add-paths:
|
||||||
|
description: >
|
||||||
|
A comma or newline-separated list of file paths to commit.
|
||||||
|
Paths should follow git's pathspec syntax.
|
||||||
|
Defaults to adding all new and modified files.
|
||||||
|
default: |
|
||||||
|
-A
|
||||||
commit-message:
|
commit-message:
|
||||||
description: 'The message to use when committing changes.'
|
description: 'The message to use when committing changes.'
|
||||||
default: '[create-pull-request] automated change'
|
default: '[create-pull-request] automated change'
|
||||||
|
|
12
dist/index.js
vendored
12
dist/index.js
vendored
|
@ -98,7 +98,7 @@ function splitLines(multilineString) {
|
||||||
.map(s => s.trim())
|
.map(s => s.trim())
|
||||||
.filter(x => x !== '');
|
.filter(x => x !== '');
|
||||||
}
|
}
|
||||||
function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName, signoff) {
|
function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName, signoff, addPaths) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
// Get the working base.
|
// Get the working base.
|
||||||
// When a ref, it may or may not be the actual base.
|
// When a ref, it may or may not be the actual base.
|
||||||
|
@ -124,12 +124,17 @@ function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName
|
||||||
// Commit any uncommitted changes
|
// Commit any uncommitted changes
|
||||||
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']);
|
for (const path of addPaths) {
|
||||||
|
yield git.exec(['add', path], true);
|
||||||
|
}
|
||||||
const params = ['-m', commitMessage];
|
const params = ['-m', commitMessage];
|
||||||
if (signoff) {
|
if (signoff) {
|
||||||
params.push('--signoff');
|
params.push('--signoff');
|
||||||
}
|
}
|
||||||
yield git.commit(params);
|
yield git.commit(params);
|
||||||
|
// Remove uncommitted tracked and untracked changes
|
||||||
|
yield git.exec(['reset', '--hard']);
|
||||||
|
yield git.exec(['clean', '-f']);
|
||||||
}
|
}
|
||||||
// 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
|
||||||
|
@ -377,7 +382,7 @@ function createPullRequest(inputs) {
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
// Create or update the pull request branch
|
// Create or update the pull request branch
|
||||||
core.startGroup('Create or update the pull request branch');
|
core.startGroup('Create or update the pull request branch');
|
||||||
const result = yield (0, create_or_update_branch_1.createOrUpdateBranch)(git, inputs.commitMessage, inputs.base, inputs.branch, branchRemoteName, inputs.signoff);
|
const result = yield (0, create_or_update_branch_1.createOrUpdateBranch)(git, inputs.commitMessage, inputs.base, inputs.branch, branchRemoteName, inputs.signoff, inputs.addPaths);
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
if (['created', 'updated'].includes(result.action)) {
|
if (['created', 'updated'].includes(result.action)) {
|
||||||
// The branch was created or updated
|
// The branch was created or updated
|
||||||
|
@ -1074,6 +1079,7 @@ function run() {
|
||||||
const inputs = {
|
const inputs = {
|
||||||
token: core.getInput('token'),
|
token: core.getInput('token'),
|
||||||
path: core.getInput('path'),
|
path: core.getInput('path'),
|
||||||
|
addPaths: utils.getInputAsArray('add-paths'),
|
||||||
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'),
|
||||||
|
|
1
report.txt
Normal file
1
report.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
1639382892
|
Loading…
Add table
Add a link
Reference in a new issue