Skip to content

Commit 6818ac3

Browse files
committed
if commit list is empty, don't pull commit message (temp solution)
1 parent 3658561 commit 6818ac3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

main.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
event_path = os.getenv("GITHUB_EVENT_PATH")
1717
sha = os.getenv("GITHUB_SHA")
1818
actor = os.getenv("GITHUB_ACTOR")
19+
event_payload = json.load(open(event_path))
1920

2021
message = {
2122
"text": f":rocket: Running *{workflow}* on *{repository}/{branch}* :rocket:",
@@ -55,7 +56,7 @@
5556
},
5657
{
5758
"title": "Commit Message",
58-
"value": '```' + json.load(open(event_path))["commits"][-1]["message"] + '```',
59+
"value": '```' + event_payload["commits"][-1]["message"] + '```' if event_payload.get("commits") else '',
5960
"short": False
6061
}
6162
],

0 commit comments

Comments
 (0)