diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/mod-ci-github-service-data.cxx | 28 | ||||
-rw-r--r-- | mod/mod-ci-github-service-data.hxx | 2 | ||||
-rw-r--r-- | mod/mod-ci-github.cxx | 3 |
3 files changed, 28 insertions, 5 deletions
diff --git a/mod/mod-ci-github-service-data.cxx b/mod/mod-ci-github-service-data.cxx index 7e61f09..31239c4 100644 --- a/mod/mod-ci-github-service-data.cxx +++ b/mod/mod-ci-github-service-data.cxx @@ -26,6 +26,22 @@ namespace brep to_string (version)); } + { + string v (p.next_expect_member_string ("kind")); + + if (v == "local") kind = local; + else if (v == "remote") kind = remote; + else + { + throw json::invalid_json_input ( + p.input_name, p.line (), p.column (), p.position (), + "invalid service data kind: '" + v + '\''); + } + } + + pre_check = p.next_expect_member_boolean<bool> ("pre_check"); + re_request = p.next_expect_member_boolean<bool> ("re_request"); + warning_success = p.next_expect_member_boolean<bool> ("warning_success"); // Installation access token. @@ -50,6 +66,7 @@ namespace brep pr_number = p.next_expect_member_number_null<uint32_t> ("pr_number"); + check_sha = p.next_expect_member_string ("check_sha"); report_sha = p.next_expect_member_string ("report_sha"); p.next_expect_member_array ("check_runs"); @@ -156,6 +173,16 @@ namespace brep s.member ("version", 1); + s.member_name ("kind"); + switch (kind) + { + case local: s.value ("local"); break; + case remote: s.value ("remote"); break; + } + + s.member ("pre_check", pre_check); + s.member ("re_request", re_request); + s.member ("warning_success", warning_success); // Installation access token. @@ -181,6 +208,7 @@ namespace brep else s.value (nullptr); + s.member ("check_sha", check_sha); s.member ("report_sha", report_sha); s.member_begin_array ("check_runs"); diff --git a/mod/mod-ci-github-service-data.hxx b/mod/mod-ci-github-service-data.hxx index 5d3cd3b..eb81ae4 100644 --- a/mod/mod-ci-github-service-data.hxx +++ b/mod/mod-ci-github-service-data.hxx @@ -74,8 +74,6 @@ namespace brep // Kind and phase. // - // @@ TODO Serialize these fields. - // enum kind_type {local, remote /*, queue */} kind; bool pre_check; bool re_request; // Re-requested (rebuild). diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx index a6ad4bc..60a6bae 100644 --- a/mod/mod-ci-github.cxx +++ b/mod/mod-ci-github.cxx @@ -752,9 +752,6 @@ namespace brep // job might actually still be relevant (in both local and remote PR // cases). - // @@ TODO Serialize the new service_data fields! - // - // Distinguish between local and remote PRs by comparing the head and base // repositories' paths. // |