in src/dialog.tsx [129:181]
async processTargetAsync(
target: ICherryPickTarget,
pullRequestContext: GitPullRequest
): Promise<IResult> {
try {
const result: IResult = {};
// Create cherry-pick
const cherryPickResult = await CherryPickCommitsAsync(
pullRequestContext,
target.topicBranch,
target.targetBranch
);
if (cherryPickResult.error || !cherryPickResult.result) {
result.error =
cherryPickResult.error ||
`Unable to cherry-pick to ${target.topicBranch}`;
return result;
}
result.cherryPick = cherryPickResult.result;
result.cherryPickUrl = formatCherryPickUrl(cherryPickResult.result);
// If !CreatePr -> continue to next target
if (!target.createPr) {
return result;
}
const createdPrResult = await CreatePullRequestAsync(
cherryPickResult.result,
pullRequestContext,
target.topicBranch,
target.targetBranch,
target.pullRequestName
);
if (createdPrResult.error || !createdPrResult.result) {
result.error =
createdPrResult.error || "Was not able to complete the PR";
return result;
}
result.pullRequest = createdPrResult.result;
result.pullRequestUrl = formatPrUrl(createdPrResult.result);
result.errorExists = false;
return result;
} catch (ex) {
console.error(ex);
return {};
}
}