aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar jesopo2019-02-07 22:59:50 +0000
committerGravatar jesopo2019-02-07 22:59:50 +0000
commita1496e54156174dc1ec28f29ea3890c6ecb4be4e (patch)
treebe0ce181175af5c158142b06ac50dcdd6b31823a
parentReturn "0s" from utils.to_pretty_time when given 0 seconds (diff)
signature
Check that a `check_run` actually started before it finished (github)
-rw-r--r--modules/github/__init__.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/github/__init__.py b/modules/github/__init__.py
index a7f0f1ca..7dcdef90 100644
--- a/modules/github/__init__.py
+++ b/modules/github/__init__.py
@@ -554,8 +554,9 @@ class Module(ModuleManager.BaseModule):
if data["check_run"]["completed_at"]:
started_at = self._iso8601(data["check_run"]["started_at"])
completed_at = self._iso8601(data["check_run"]["completed_at"])
- seconds = (completed_at-started_at).total_seconds()
- duration = " in %s" % utils.to_pretty_time(seconds)
+ if completed_at > started_at:
+ seconds = (completed_at-started_at).total_seconds()
+ duration = " in %s" % utils.to_pretty_time(seconds)
status = data["check_run"]["status"]
status_str = ""