Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

Commit

Permalink
Main: handle releases (fixes #5)
Browse files Browse the repository at this point in the history
  • Loading branch information
jae1911 committed Jan 6, 2022
1 parent 37482f8 commit e2589cb
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,25 @@ def gh_webhook():
res_string = 'ok'
else:
star_sender = json_data.get('sender')
star_timestamp = json.get('starred_at')
star_timestamp = json_data.get('starred_at')
star_giver = star_sender['login']
res_string += f'{star_giver} starred {repo_name} on {star_timestamp}.'
send_message = True
elif event_type == 'release':
# Release
rel_data = json_data.get('release')

rel_url = rel_data['html_url']
rel_name = rel_data['tag_name']
rel_maker = rel_data['author']['login']

rel_action = json_data.get('action')

if rel_action == 'published':
res_string += f'{rel_maker} created the [{rel_name}]({rel_url}) release.'
send_message = True
else:
res_string = 'ok'
else:
# If a certain event isn't implemented, we log it
log.warn(f'{event_type} is not implemented')
Expand Down

0 comments on commit e2589cb

Please sign in to comment.