Skip to content

Commit

Permalink
Ignore push event without commits (#7)
Browse files Browse the repository at this point in the history
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
```
  • Loading branch information
vsoch authored Jan 22, 2021
1 parent a815054 commit b7188c6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions scripts/generate-events.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ def generate_content(event, user, seen):

# Content for description on the kind of event
if event_type == "PushEvent":
if not event["payload"]["commits"]:
return None
commit_url = "%s/commit/%s" % (repo, event["payload"]["commits"][-1]["sha"])
message = event["payload"]["commits"][-1]["message"]
description = (
Expand Down

0 comments on commit b7188c6

Please sign in to comment.