[CI] test built

This commit is contained in:
peter-evans 2022-11-29 06:11:21 +00:00 committed by GitHub
parent 2b011faafd
commit 75d820c361
2 changed files with 29 additions and 4 deletions

32
dist/index.js vendored
View file

@ -158,9 +158,8 @@ function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName
throw new Error(`Unexpected error: ${commitResult.stderr}`); throw new Error(`Unexpected error: ${commitResult.stderr}`);
} }
} }
// Remove uncommitted tracked and untracked changes // Stash any uncommitted tracked and untracked changes
yield git.exec(['reset', '--hard']); const stashed = yield git.stashPush(['--include-untracked']);
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) {
@ -258,6 +257,12 @@ function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName
result.headSha = yield git.revParse('HEAD'); result.headSha = yield git.revParse('HEAD');
// Delete the temporary branch // Delete the temporary branch
yield git.exec(['branch', '--delete', '--force', tempBranch]); 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; return result;
}); });
} }
@ -426,7 +431,7 @@ function createPullRequest(inputs) {
yield git.push([ yield git.push([
'--force-with-lease', '--force-with-lease',
branchRemoteName, branchRemoteName,
`HEAD:refs/heads/${inputs.branch}` `${inputs.branch}:refs/heads/${inputs.branch}`
]); ]);
core.endGroup(); core.endGroup();
} }
@ -842,6 +847,25 @@ class GitCommandManager {
return output.stdout.trim(); 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) { status(options) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const args = ['status']; const args = ['status'];

1
report.txt Normal file
View file

@ -0,0 +1 @@
1669702280