aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois Kritzinger <francois@codesynthesis.com>2024-05-08 16:57:18 +0200
committerFrancois Kritzinger <francois@codesynthesis.com>2024-06-05 09:12:46 +0200
commit1d4845b021f06e100b67b0dcbf59767bb3d8fd6d (patch)
tree1273f80395d829f2c7efe0b89c9d47c68543c7ca
parentba32e665e10fd513a866c4ee565cdefe8bcc639e (diff)
Set check run's `started at` to current time if updating to building
-rw-r--r--mod/mod-ci-github-gq.cxx22
-rw-r--r--mod/mod-ci-github.cxx2
2 files changed, 18 insertions, 6 deletions
diff --git a/mod/mod-ci-github-gq.cxx b/mod/mod-ci-github-gq.cxx
index 4a4f56d..28f8e18 100644
--- a/mod/mod-ci-github-gq.cxx
+++ b/mod/mod-ci-github-gq.cxx
@@ -385,10 +385,11 @@ namespace brep
// conclusion.
//
static string
- gq_mutation_update_check_run (const string& ri, // Repository ID.
- const string& ni, // Node ID.
- const string& du, // Details URL.
- const string& st, // Check run status.
+ gq_mutation_update_check_run (const string& ri, // Repository ID.
+ const string& ni, // Node ID.
+ const string& du, // Details URL.
+ const string& st, // Check run status.
+ optional<timestamp> sa, // Started at.
optional<gq_built_result> br)
{
ostringstream os;
@@ -398,6 +399,11 @@ namespace brep
<< " checkRunId: " << gq_str (ni) << '\n'
<< " repositoryId: " << gq_str (ri) << '\n'
<< " status: " << gq_enum (st);
+ if (sa)
+ {
+ os << '\n';
+ os << " startedAt: " << gq_str (gh_to_iso8601 (*sa));
+ }
if (!du.empty ())
{
os << '\n';
@@ -502,12 +508,20 @@ namespace brep
//
assert (!du.empty ());
+ // Set `started at` to current time if updating to building.
+ //
+ optional<timestamp> sa;
+
+ if (st == build_state::building)
+ sa = system_clock::now ();
+
string rq (
gq_serialize_request (
gq_mutation_update_check_run (rid,
nid,
du,
gh_to_status (st),
+ sa,
move (br))));
vector<check_run> crs {move (cr)};
diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx
index ad3a002..d1f50f2 100644
--- a/mod/mod-ci-github.cxx
+++ b/mod/mod-ci-github.cxx
@@ -716,8 +716,6 @@ namespace brep
//
if (iat != nullptr)
{
- // @@ TODO: send timestamp so that build duration is accurate?
-
if (gq_update_check_run (error,
*cr,
iat->token,