[CI] test committed
This commit is contained in:
parent
0fd77ba8cc
commit
98620f5455
2 changed files with 17 additions and 23 deletions
39
dist/index.js
vendored
39
dist/index.js
vendored
|
@ -93,12 +93,6 @@ function isEven(git, branch1, branch2) {
|
||||||
!(yield isBehind(git, branch1, branch2)));
|
!(yield isBehind(git, branch1, branch2)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function hasDiff(git, branch1, branch2) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const result = yield git.diff([`${branch1}..${branch2}`]);
|
|
||||||
return result.length > 0;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function splitLines(multilineString) {
|
function splitLines(multilineString) {
|
||||||
return multilineString
|
return multilineString
|
||||||
.split('\n')
|
.split('\n')
|
||||||
|
@ -192,7 +186,7 @@ function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName
|
||||||
// squash merged but not deleted. We need to reset to make sure it doesn't appear
|
// squash merged but not deleted. We need to reset to make sure it doesn't appear
|
||||||
// to have a diff with the base due to different commits for the same changes.
|
// to have a diff with the base due to different commits for the same changes.
|
||||||
// For changes on base this reset is equivalent to a rebase of the pull request branch.
|
// For changes on base this reset is equivalent to a rebase of the pull request branch.
|
||||||
if ((yield hasDiff(git, branch, tempBranch)) ||
|
if ((yield git.hasDiff([`${branch}..${tempBranch}`])) ||
|
||||||
!(yield isAhead(git, base, tempBranch))) {
|
!(yield isAhead(git, base, tempBranch))) {
|
||||||
core.info(`Resetting '${branch}'`);
|
core.info(`Resetting '${branch}'`);
|
||||||
// Alternatively, git switch -C branch tempBranch
|
// Alternatively, git switch -C branch tempBranch
|
||||||
|
@ -662,16 +656,6 @@ class GitCommandManager {
|
||||||
return output.exitCode === 0;
|
return output.exitCode === 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
diff(options) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const args = ['-c', 'core.pager=cat', 'diff'];
|
|
||||||
if (options) {
|
|
||||||
args.push(...options);
|
|
||||||
}
|
|
||||||
const output = yield this.exec(args);
|
|
||||||
return output.stdout.trim();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
fetch(refSpec, remoteName, options) {
|
fetch(refSpec, remoteName, options) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const args = ['-c', 'protocol.version=2', 'fetch'];
|
const args = ['-c', 'protocol.version=2', 'fetch'];
|
||||||
|
@ -712,19 +696,28 @@ class GitCommandManager {
|
||||||
getWorkingDirectory() {
|
getWorkingDirectory() {
|
||||||
return this.workingDirectory;
|
return this.workingDirectory;
|
||||||
}
|
}
|
||||||
|
hasDiff(options) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const args = ['diff', '--quiet'];
|
||||||
|
if (options) {
|
||||||
|
args.push(...options);
|
||||||
|
}
|
||||||
|
const output = yield this.exec(args, true);
|
||||||
|
return output.exitCode === 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
isDirty(untracked) {
|
isDirty(untracked) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const diffArgs = ['--abbrev=40', '--full-index', '--raw'];
|
// Check untracked changes
|
||||||
// Check staged changes
|
if (untracked && (yield this.status(['--porcelain', '-unormal']))) {
|
||||||
if (yield this.diff([...diffArgs, '--staged'])) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Check working index changes
|
// Check working index changes
|
||||||
if (yield this.diff(diffArgs)) {
|
if (yield this.hasDiff()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Check untracked changes
|
// Check staged changes
|
||||||
if (untracked && (yield this.status(['--porcelain', '-unormal']))) {
|
if (yield this.hasDiff(['--staged'])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
1
report.txt
Normal file
1
report.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
1605581159
|
Loading…
Add table
Add a link
Reference in a new issue