Skip to content

Commit

Permalink
Checking merged twice
Browse files Browse the repository at this point in the history
  • Loading branch information
CatChen committed Aug 12, 2022
1 parent e5db97b commit bde2582
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 18 deletions.
17 changes: 13 additions & 4 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

17 changes: 13 additions & 4 deletions lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 24 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@ async function run(): Promise<void> {
const pullRequestNumber = (context.payload.pull_request as PullRequest)
.number;

const merged = await checkIfPullRequestMerged(
owner,
repo,
pullRequestNumber,
octokit
);
if (merged) {
error(`This Pull Request has been merged already.`);
return;
{
const merged = await checkIfPullRequestMerged(
owner,
repo,
pullRequestNumber,
octokit
);
if (merged) {
error(`This Pull Request has been merged already.`);
return;
}
}

const pullRequest = await getPullRequest(
Expand Down Expand Up @@ -193,6 +195,19 @@ async function run(): Promise<void> {
}
}

{
const merged = await checkIfPullRequestMerged(
owner,
repo,
pullRequestNumber,
octokit
);
if (merged) {
error(`This Pull Request has been merged already.`);
return;
}
}

await mergePullRequest(owner, repo, pullRequestNumber, octokit);
}

Expand Down

0 comments on commit bde2582

Please sign in to comment.