Skip to content

Commit

Permalink
Merge pull request #105 from NandosUK/features/nap-387-events-git
Browse files Browse the repository at this point in the history
Events in github
  • Loading branch information
nav-nandos authored Feb 28, 2022
2 parents f3297a8 + 7c4b943 commit 1465b86
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion bq-workers/github-parser/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,14 @@ def process_github_event(headers, msg):
types = {"push", "pull_request", "pull_request_review",
"pull_request_review_comment", "issues",
"issue_comment", "check_run", "check_suite", "status",
"deployment_status", "release"}
"deployment_status", "release", "deployment", "create"}

if event_type not in types:
raise Exception("Unsupported GitHub event: '%s'" % event_type)

metadata = json.loads(base64.b64decode(msg["data"]).decode("utf-8").strip())

print(f" Print Metadata from the github event : {metadata}")
if event_type == "push":
time_created = metadata["head_commit"]["timestamp"]
e_id = metadata["head_commit"]["id"]
Expand Down Expand Up @@ -137,6 +138,11 @@ def process_github_event(headers, msg):
time_created = (metadata["release"]["published_at"] or
metadata["release"]["created_at"])
e_id = metadata["release"]["id"]

if event_type == "deployment":
time_created = metadata["deployment"]["updated_at"]
e_id = metadata["deployment"]["id"]


github_event = {
"event_type": event_type,
Expand Down

0 comments on commit 1465b86

Please sign in to comment.