Skip to content
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.

Commit

Permalink
🐛 Use PR type
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Aug 18, 2020
1 parent 8b28e31 commit 320fcac
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,26 @@ export const run = async () => {
return console.log("No pull request found");

const pullRequest = (context as any).payload.pull_request
.body as EventPayloads.WebhookPayloadPullRequest;
.body as EventPayloads.WebhookPayloadPullRequestPullRequest;

console.log("Pull number", pullRequest.pull_request);
console.log(
"Merged",
pullRequest.pull_request.merged,
(pullRequest as any).merged
);
console.log("Pull number", pullRequest);
console.log("Merged", pullRequest.merged, (pullRequest as any).merged);

/**
* Pull request has been merged
*/
if (pullRequest.pull_request.merged) {
if (pullRequest.merged) {
try {
if (
!(getInput("protectBranches") || "")
.split(",")
.map((branch) => branch.trim())
.includes(pullRequest.pull_request.base.ref)
.includes(pullRequest.base.ref)
)
await octokit.git.deleteRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: pullRequest.pull_request.base.ref,
ref: pullRequest.base.ref,
});
} catch (error) {}
}
Expand Down

0 comments on commit 320fcac

Please sign in to comment.