From 8a236af7b7d3cca819e6c87944829c83e9bbb99d Mon Sep 17 00:00:00 2001 From: Francois Kritzinger Date: Wed, 8 May 2024 16:57:18 +0200 Subject: Set check run's `started at` to current time if updating to building --- mod/mod-ci-github-gq.cxx | 22 ++++++++++++++++++---- mod/mod-ci-github.cxx | 2 -- 2 files changed, 18 insertions(+), 6 deletions(-) (limited to 'mod') 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 sa, // Started at. optional 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 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 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, -- cgit v1.1