Browse Source

Fix git commit message handling.

Only include the first line. Reverse order of commits so they're
chronological.
master
Chris Smith 5 years ago
parent
commit
4cc8b68c95
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      main.py

+ 3
- 2
main.py View File

@@ -18,9 +18,10 @@ def handle_events(events):
18 18
                     f"\002[git]\002 {event['user']} pushed {len(event['commits'])} commit{'s' if len(event['commits']) != 1 else ''} to {event['repo']['name']}: {event['compare_url']}"
19 19
                 )
20 20
 
21
-                for commit in event["commits"][:3]:
21
+                for commit in event["commits"][::-1][:3]:
22
+                    line = commit["message"].split("\n")[0][:100]
22 23
                     services["reportbot"].announce(
23
-                        f"\002[git]\002 {commit['id']}: {commit['message'][:100]}"
24
+                        f"\002[git]\002 {commit['id']}: {line}"
24 25
                     )
25 26
         elif event["type"] == "docker.push":
26 27
             services["reportbot"].announce(

Loading…
Cancel
Save