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
0e8dfbd57d
commit
d24e3581b5
3 changed files with 24 additions and 15 deletions
|
@ -13,8 +13,6 @@ inputs:
|
||||||
A comma or newline-separated list of file paths to commit.
|
A comma or newline-separated list of file paths to commit.
|
||||||
Paths should follow git's pathspec syntax.
|
Paths should follow git's pathspec syntax.
|
||||||
Defaults to adding all new and modified files.
|
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'
|
||||||
|
|
36
dist/index.js
vendored
36
dist/index.js
vendored
|
@ -122,20 +122,25 @@ function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName
|
||||||
const tempBranch = (0, uuid_1.v4)();
|
const tempBranch = (0, uuid_1.v4)();
|
||||||
yield git.checkout(tempBranch, 'HEAD');
|
yield git.checkout(tempBranch, 'HEAD');
|
||||||
// Commit any uncommitted changes
|
// Commit any uncommitted changes
|
||||||
if (yield git.isDirty(true)) {
|
if (yield git.isDirty(true, addPaths)) {
|
||||||
core.info('Uncommitted changes found. Adding a commit.');
|
core.info('Uncommitted changes found. Adding a commit.');
|
||||||
for (const path of addPaths) {
|
const aopts = ['add'];
|
||||||
yield git.exec(['add', path], true);
|
if (addPaths.length > 0) {
|
||||||
|
aopts.push(...['--', ...addPaths]);
|
||||||
}
|
}
|
||||||
const params = ['-m', commitMessage];
|
else {
|
||||||
|
aopts.push('-A');
|
||||||
|
}
|
||||||
|
yield git.exec(aopts, true);
|
||||||
|
const popts = ['-m', commitMessage];
|
||||||
if (signoff) {
|
if (signoff) {
|
||||||
params.push('--signoff');
|
popts.push('--signoff');
|
||||||
}
|
}
|
||||||
yield git.commit(params);
|
yield git.commit(popts);
|
||||||
// Remove uncommitted tracked and untracked changes
|
|
||||||
yield git.exec(['reset', '--hard']);
|
|
||||||
yield git.exec(['clean', '-f']);
|
|
||||||
}
|
}
|
||||||
|
// Remove uncommitted tracked and untracked changes
|
||||||
|
yield git.exec(['reset', '--hard']);
|
||||||
|
yield git.exec(['clean', '-f', '-d']);
|
||||||
// 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
|
||||||
if (workingBaseType == WorkingBaseType.Branch) {
|
if (workingBaseType == WorkingBaseType.Branch) {
|
||||||
|
@ -752,18 +757,23 @@ class GitCommandManager {
|
||||||
return output.exitCode === 1;
|
return output.exitCode === 1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
isDirty(untracked) {
|
isDirty(untracked, pathspec) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const pathspecArgs = pathspec ? ['--', ...pathspec] : [];
|
||||||
// Check untracked changes
|
// Check untracked changes
|
||||||
if (untracked && (yield this.status(['--porcelain', '-unormal']))) {
|
const sargs = ['--porcelain', '-unormal'];
|
||||||
|
sargs.push(...pathspecArgs);
|
||||||
|
if (untracked && (yield this.status(sargs))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Check working index changes
|
// Check working index changes
|
||||||
if (yield this.hasDiff()) {
|
if (yield this.hasDiff(pathspecArgs)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Check staged changes
|
// Check staged changes
|
||||||
if (yield this.hasDiff(['--staged'])) {
|
const dargs = ['--staged'];
|
||||||
|
dargs.push(...pathspecArgs);
|
||||||
|
if (yield this.hasDiff(dargs)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
1
report.txt
Normal file
1
report.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
1648011195
|
Loading…
Add table
Add a link
Reference in a new issue