Skip to content

Commit b7188c6

Browse files
authored
Ignore push event without commits (#7)
I'm not sure what causes this, but it just triggered in one of the runs: ```bash Traceback (most recent call last): File "/generate-events.py", line 361, in <module> main() File "/generate-events.py", line 357, in main write_events(events, output_dir) File "/generate-events.py", line 282, in write_events content = generate_content(event, username, seen) File "/generate-events.py", line 142, in generate_content commit_url = "%s/commit/%s" % (repo, event["payload"]["commits"][-1]["sha"]) IndexError: list index out of range ```
1 parent a815054 commit b7188c6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

scripts/generate-events.py

+2
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ def generate_content(event, user, seen):
139139

140140
# Content for description on the kind of event
141141
if event_type == "PushEvent":
142+
if not event["payload"]["commits"]:
143+
return None
142144
commit_url = "%s/commit/%s" % (repo, event["payload"]["commits"][-1]["sha"])
143145
message = event["payload"]["commits"][-1]["message"]
144146
description = (

0 commit comments

Comments
 (0)