Trim whitespace, fetch origin master

This commit is contained in:
Wesley Wigham
2019-05-31 14:36:39 -07:00
parent 8813ceb3ce
commit 619648e8c2

View File

@@ -24,14 +24,17 @@ async function main() {
]);
const currentAuthor = runSequence([
["git", ["log", "-1", `--pretty="%aN <%aE>"`]]
])
]);
runSequence([
["git", ["fetch", "origin", "master"]]
]);
let logText = runSequence([
["git", ["log", `master..${currentSha}`, `--pretty="%h %s%n%b"`]]
["git", ["log", `origin/master..${currentSha.trim()}`, `--pretty="%h %s%n%b"`]]
]);
logText = `Cherry-pick PR #${process.env.SOURCE_ISSUE} into ${process.env.TARGET_BRANCH}
Component commits:
${logText}`
${logText.trim()}`
const logpath = path.join(__dirname, "../", "logmessage.txt");
runSequence([
["git", ["checkout", "-b", "temp-branch"]],
@@ -39,7 +42,7 @@ ${logText}`
]);
fs.writeFileSync(logpath, logText);
runSequence([
["git", ["commit", "-F", logpath, `--author="${currentAuthor}"`]]
["git", ["commit", "-F", logpath, `--author="${currentAuthor.trim()}"`]]
]);
fs.unlinkSync(logpath);
const squashSha = runSequence([
@@ -48,7 +51,7 @@ ${logText}`
runSequence([
["git", ["checkout", process.env.TARGET_BRANCH]], // checkout the target branch
["git", ["checkout", "-b", branchName]], // create a new branch
["git", ["cherry-pick", squashSha]], //
["git", ["cherry-pick", squashSha.trim()]], //
["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork
["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch
]);