-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpullRequestEventHandler.py
More file actions
25 lines (21 loc) · 977 Bytes
/
pullRequestEventHandler.py
File metadata and controls
25 lines (21 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class PrEventHandler:
def __init__(self) -> None:
pass
def handleEvent(self, eventData):
# 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 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"])
def handleAbandoned(self, eventData):
# Action for abandoned PRs (closed but not merged)
print("PR Abandoned:", eventData["pull_request"]["title"])