mirror of
https://forgejo.stefka.eu/jiriks74/create-pull-request.git
synced 2025-01-18 16:01:06 +01:00
[CI] test built
This commit is contained in:
parent
2b011faafd
commit
75d820c361
2 changed files with 29 additions and 4 deletions
32
dist/index.js
vendored
32
dist/index.js
vendored
|
@ -158,9 +158,8 @@ function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName
|
|||
throw new Error(`Unexpected error: ${commitResult.stderr}`);
|
||||
}
|
||||
}
|
||||
// Remove uncommitted tracked and untracked changes
|
||||
yield git.exec(['reset', '--hard']);
|
||||
yield git.exec(['clean', '-f', '-d']);
|
||||
// Stash any uncommitted tracked and untracked changes
|
||||
const stashed = yield git.stashPush(['--include-untracked']);
|
||||
// Perform fetch and reset the working base
|
||||
// Commits made during the workflow will be removed
|
||||
if (workingBaseType == WorkingBaseType.Branch) {
|
||||
|
@ -258,6 +257,12 @@ function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName
|
|||
result.headSha = yield git.revParse('HEAD');
|
||||
// Delete the temporary branch
|
||||
yield git.exec(['branch', '--delete', '--force', tempBranch]);
|
||||
// Checkout the working base to leave the local repository as it was found
|
||||
yield git.checkout(workingBase);
|
||||
// Restore any stashed changes
|
||||
if (stashed) {
|
||||
yield git.stashPop();
|
||||
}
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
@ -426,7 +431,7 @@ function createPullRequest(inputs) {
|
|||
yield git.push([
|
||||
'--force-with-lease',
|
||||
branchRemoteName,
|
||||
`HEAD:refs/heads/${inputs.branch}`
|
||||
`${inputs.branch}:refs/heads/${inputs.branch}`
|
||||
]);
|
||||
core.endGroup();
|
||||
}
|
||||
|
@ -842,6 +847,25 @@ class GitCommandManager {
|
|||
return output.stdout.trim();
|
||||
});
|
||||
}
|
||||
stashPush(options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const args = ['stash', 'push'];
|
||||
if (options) {
|
||||
args.push(...options);
|
||||
}
|
||||
const output = yield this.exec(args);
|
||||
return output.stdout.trim() !== 'No local changes to save';
|
||||
});
|
||||
}
|
||||
stashPop(options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const args = ['stash', 'pop'];
|
||||
if (options) {
|
||||
args.push(...options);
|
||||
}
|
||||
yield this.exec(args);
|
||||
});
|
||||
}
|
||||
status(options) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const args = ['status'];
|
||||
|
|
1
report.txt
Normal file
1
report.txt
Normal file
|
@ -0,0 +1 @@
|
|||
1669702280
|
Loading…
Add table
Add a link
Reference in a new issue