From 3d83dbc96b3ef52b4c95ff119185d7804a01d640 Mon Sep 17 00:00:00 2001 From: Durgesh kumar prajapati <98798977+Durgesh4993@users.noreply.github.com> Date: Tue, 26 Mar 2024 12:22:45 +0530 Subject: [PATCH] Update pullRequestEventHandler.py --- events/pullRequestEventHandler.py | 32 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/events/pullRequestEventHandler.py b/events/pullRequestEventHandler.py index 692240d..956a16a 100644 --- a/events/pullRequestEventHandler.py +++ b/events/pullRequestEventHandler.py @@ -1,25 +1,25 @@ class PrEventHandler: def __init__(self) -> None: - return + pass def handleEvent(self, eventData): - #pr Raised + # Check if the action is one of the events to be ignored if eventData["action"] in ['assigned', 'edited', 'labeled', 'opened', 'ready_for_review', 'reopened', 'review_requested', 'unlocked']: return - - if eventData["action"] in ['closed']: - #merged - #abandoned - #pr abandoned + # If the action is 'closed' + if eventData["action"] == 'closed': + if eventData["merged"]: + # Action for merged PRs + self.handleMerged(eventData) + else: + # Action for closed but not merged (abandoned) PRs + self.handleAbandoned(eventData) + def handleMerged(self, eventData): + # Action for merged PRs + print("PR Merged:", eventData["pull_request"]["title"]) - - #prMerged corresponds to a close - - #pr Reviewed and accepted - - - # assigned, closed, converted_to_draft, demilestoned, dequeued, edited, enqueued, labeled, locked, milestoned, opened, ready_for_review, reopened, request_review_removed, review_requested, unassigned, unlabeled, unlocked - - return \ No newline at end of file + def handleAbandoned(self, eventData): + # Action for abandoned PRs (closed but not merged) + print("PR Abandoned:", eventData["pull_request"]["title"])