From 40a3855e2341529624050b4324e73e774967111a Mon Sep 17 00:00:00 2001 From: Francois Kritzinger Date: Tue, 10 Dec 2024 10:31:47 +0200 Subject: Handle re-runs of single check runs --- mod/mod-ci-github-gh.hxx | 44 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) (limited to 'mod/mod-ci-github-gh.hxx') diff --git a/mod/mod-ci-github-gh.hxx b/mod/mod-ci-github-gh.hxx index f3bcfeb..b29904b 100644 --- a/mod/mod-ci-github-gh.hxx +++ b/mod/mod-ci-github-gh.hxx @@ -27,18 +27,21 @@ namespace brep // GitHub request/response types (all start with gh_). // - // Note that the GitHub REST and GraphQL APIs use different ID types and + // Note that the GitHub REST and GraphQL APIs use different id types and // values. In the REST API they are usually integers (but sometimes // strings!) whereas in GraphQL they are always strings (note: - // base64-encoded and opaque, not just the REST ID value as a string). + // base64-encoded and opaque, not just the REST id value as a string). // - // In both APIs the ID field is called `id`, but REST responses and webhook - // events also contain the corresponding GraphQL object's ID in the + // In both APIs the id field is called `id`, but REST responses and webhook + // events also contain the corresponding GraphQL object's id in the // `node_id` field. // - // In the structures below we always use the RESP API/webhook names for ID - // fields. I.e., `id` always refers to the REST/webhook ID, and `node_id` - // always refers to the GraphQL ID. + // The GraphQL API's ids are called "global node ids" by GitHub. We refer to + // them simply as node ids and we use them almost exclusively (over the + // REST/webhook ids). + // + // In the structures below, `id` always refers to the REST/webhook id and + // `node_id` always refers to the node id. // namespace json = butl::json; @@ -68,6 +71,17 @@ namespace brep gh_check_run () = default; }; + struct gh_check_run_ex: gh_check_run + { + string details_url; + gh_check_suite check_suite; + + explicit + gh_check_run_ex (json::parser&); + + gh_check_run_ex () = default; + }; + struct gh_pull_request { string node_id; @@ -151,6 +165,19 @@ namespace brep gh_check_suite_event () = default; }; + struct gh_check_run_event + { + string action; + gh_check_run_ex check_run; + gh_repository repository; + gh_installation installation; + + explicit + gh_check_run_event (json::parser&); + + gh_check_run_event () = default; + }; + struct gh_pull_request_event { string action; @@ -203,6 +230,9 @@ namespace brep operator<< (ostream&, const gh_check_suite_event&); ostream& + operator<< (ostream&, const gh_check_run_event&); + + ostream& operator<< (ostream&, const gh_pull_request_event&); ostream& -- cgit v1.1