From 6818ac3818f7b5f713917dde53fd8f81dc5e8cf4 Mon Sep 17 00:00:00 2001 From: Florentino Bexiga Date: Wed, 15 Sep 2021 16:22:36 +0100 Subject: [PATCH] if commit list is empty, don't pull commit message (temp solution) --- main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index 3def829..a790455 100644 --- a/main.py +++ b/main.py @@ -16,6 +16,7 @@ event_path = os.getenv("GITHUB_EVENT_PATH") sha = os.getenv("GITHUB_SHA") actor = os.getenv("GITHUB_ACTOR") +event_payload = json.load(open(event_path)) message = { "text": f":rocket: Running *{workflow}* on *{repository}/{branch}* :rocket:", @@ -55,7 +56,7 @@ }, { "title": "Commit Message", - "value": '```' + json.load(open(event_path))["commits"][-1]["message"] + '```', + "value": '```' + event_payload["commits"][-1]["message"] + '```' if event_payload.get("commits") else '', "short": False } ],