aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois Kritzinger <francois@codesynthesis.com>2024-04-17 08:26:11 +0200
committerFrancois Kritzinger <francois@codesynthesis.com>2024-06-05 09:12:46 +0200
commitecb6669b7dc6a2fd93f91f96190842984ddffda7 (patch)
tree50a5dbd46e7f195945121cd17b253c3587365c35
parent6fbae58d89bdd4bf50e29da7ba7b7ec6df030823 (diff)
Add update_check_run()
-rw-r--r--mod/mod-ci-github.cxx31
1 files changed, 31 insertions, 0 deletions
diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx
index 631ffbd..041d160 100644
--- a/mod/mod-ci-github.cxx
+++ b/mod/mod-ci-github.cxx
@@ -655,6 +655,37 @@ namespace brep
return os.str ();
}
+ // Serialize an `updateCheckRun` mutation for one build to GraphQL.
+ //
+ // @@ TODO Support conclusion, output, etc.
+ //
+ static string
+ update_check_run (const string& ri, // Repository ID
+ const string& ci, // Check run node_id
+ build_state st)
+ {
+ ostringstream os;
+
+ os << "mutation {" << '\n'
+ << "cr0:updateCheckRun(input: {" << '\n'
+ << " checkRunId: " << gq_str (ci) << ',' << '\n'
+ << " repositoryId: " << gq_str (ri) << ',' << '\n'
+ << " status: " << gq_enum (to_string_gh (st)) << '\n'
+ << "})" << '\n'
+ // Specify the selection set (fields to be returned).
+ //
+ << "{" << '\n'
+ << " checkRun {" << '\n'
+ << " id," << '\n'
+ << " name," << '\n'
+ << " status" << '\n'
+ << " }" << '\n'
+ << "}" << '\n'
+ << "}" << '\n';
+
+ return os.str ();
+ }
+
// Serialize a GraphQL operation (query/mutation) into a GraphQL request.
//
// This is essentially a JSON object with a "query" string member containing