Skip to content

Commit

Permalink
call getPullRequest 1 less time
Browse files Browse the repository at this point in the history
  • Loading branch information
hipstersmoothie committed Jul 31, 2020
1 parent 2a0f270 commit baab296
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions plugins/released/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ export default class ReleasedLabelPlugin implements IPlugin {
const isPrerelease = releases.some((r) => r.data.prerelease);

if (commit.pullRequest) {
const branch = (await auto.git?.getPullRequest(commit.pullRequest.number))
?.data.head.ref;
const pr = await auto.git!.getPullRequest(commit.pullRequest.number);
const branch = pr?.data.head.ref;

if (branch && auto.config?.prereleaseBranches.includes(branch)) {
return;
Expand All @@ -136,7 +136,6 @@ export default class ReleasedLabelPlugin implements IPlugin {
releases,
});

const pr = await auto.git!.getPullRequest(commit.pullRequest.number);
pr.data.body.split("\n").map((line) => messages.push(line));

const commitsInPr = await auto.git!.getCommitsForPR(
Expand Down

0 comments on commit baab296

Please sign in to comment.