Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
feat: prepare for pull request by command
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Wolf committed Sep 28, 2017
1 parent a826dd1 commit 49c6c68
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/workflow-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,36 @@ export class WorkflowManager {
return await this.doCreatePullRequest(await getRepository(), body);
}

public async createPullRequestFromData(
{
sourceBranch,
targetBranch,
title,
body
}:
{
sourceBranch: string;
targetBranch: string;
title: string;
body?: string;
}
): Promise<PullRequest|undefined> {
if (await this.hasPullRequestForCurrentBranch()) {
return undefined;
}
this.log(`Create pull request on branch '${targetBranch}'`);
const pullRequestBody: CreatePullRequestBody = {
sourceBranch,
targetBranch,
title,
body
};
this.channel.appendLine('Create pull request:');
this.channel.appendLine(JSON.stringify(pullRequestBody, undefined, ' '));

return await this.doCreatePullRequest(await this.getRepository(), pullRequestBody);
}

private async doCreatePullRequest(repository: Repository,
body: CreatePullRequestBody): Promise<PullRequest> {
try {
Expand Down

0 comments on commit 49c6c68

Please sign in to comment.