Skip to content
This repository was archived by the owner on Mar 13, 2026. It is now read-only.

Commit df5134f

Browse files
committed
feat: Handle and call supported events only
1 parent d2b5f8b commit df5134f

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = github-workflows-monitoring
3-
version = 0.1
3+
version = 0.1.1
44
license-file = LICENSE
55

66
[options]

src/app.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,19 @@ def process_workflow_job():
9999
return True
100100

101101

102+
allowed_events = {
103+
"workflow_job": process_workflow_job
104+
}
105+
106+
102107
@app.route("/github-webhook", methods=["POST"])
103108
def github_webhook_process():
104109
event = request.headers.get(GithubHeaders.EVENT.value)
105-
command = f"process_{event}"
106110

107-
if command == "process_workflow_job":
108-
app.logger.debug(f"Calling function {command}")
109-
process_workflow_job()
111+
if event in allowed_events:
112+
app.logger.debug(f"Calling function to process {event=}")
113+
func = allowed_events.get(event)
114+
func()
110115
return "OK"
111116

112117
app.logger.error(f"Unknown event type {event}, can't handle")

0 commit comments

Comments
 (0)