Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding repo team event #111

Merged
merged 1 commit into from
Mar 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions bq-workers/github-parser/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def process_github_event(headers, msg):
"pull_request_review_comment", "issues",
"issue_comment", "check_run", "check_suite", "status",
"deployment_status", "release", "deployment",
"team", "membership", "repository"}
"team", "membership", "repository", "team_add"}

if event_type not in types:
raise Exception("Unsupported GitHub event: '%s'" % event_type)
Expand Down Expand Up @@ -153,13 +153,21 @@ def process_github_event(headers, msg):

if event_type == "membership":
# Team Membership events do not carry any create/update date, for adding new repo as well
# so adding the date of the basis of it arrives for processing.
# This event doesn't have unique id as it carries relation between user and team so constructing its unique id.
# so adding the date on the basis of it arrives for processing.
time_created = datetime.utcnow().isoformat()[:-3]+'Z'
e_id = metadata["member"]["id"]
e_id = metadata["team"]["name"]+"/"+str(metadata["member"]["id"])

if event_type == "repository":
time_created = metadata["repository"]["created_at"]
e_id = metadata["repository"]["id"]

if event_type == "team_add":
# Adding the date on the basis of it arrives for processing.
time_created = datetime.utcnow().isoformat()[:-3]+'Z'
# This event doesn't have unique id as it carries relation between repo and team so constructing its unique id.
# Its data would carry repository id and team id which would be used for analysis.
e_id = str(metadata["repository"]["id"])+"/"+metadata["team"]["name"]

github_event = {
"event_type": event_type,
Expand Down