diff options
author | Francois Kritzinger <francois@codesynthesis.com> | 2024-10-25 08:45:25 +0200 |
---|---|---|
committer | Francois Kritzinger <francois@codesynthesis.com> | 2024-10-25 11:22:11 +0200 |
commit | 69d87bcad5b0c252fa4cc3ee09431a822d3352ae (patch) | |
tree | f925244af6bf9419cc795fa35a3075a58c57fce0 /mod | |
parent | 1bfb0c463d49e939dabc71fbb6adbc154915e619 (diff) |
Post-review changes
Diffstat (limited to 'mod')
-rw-r--r-- | mod/mod-ci-github-gh.cxx | 25 | ||||
-rw-r--r-- | mod/mod-ci-github-gh.hxx | 4 | ||||
-rw-r--r-- | mod/mod-ci-github-service-data.cxx | 13 | ||||
-rw-r--r-- | mod/mod-ci-github-service-data.hxx | 8 | ||||
-rw-r--r-- | mod/mod-ci-github.cxx | 11 |
5 files changed, 38 insertions, 23 deletions
diff --git a/mod/mod-ci-github-gh.cxx b/mod/mod-ci-github-gh.cxx index 92b2970..dcea563 100644 --- a/mod/mod-ci-github-gh.cxx +++ b/mod/mod-ci-github-gh.cxx @@ -129,9 +129,14 @@ namespace brep return p.name () == s ? (v = true) : false; }; - if (c (ni, "node_id")) node_id = p.next_expect_string (); - else if (c (hb, "head_branch")) head_branch = p.next_expect_string (); - else if (c (hs, "head_sha")) head_sha = p.next_expect_string (); + if (c (ni, "node_id")) node_id = p.next_expect_string (); + else if (c (hb, "head_branch")) + { + string* v (p.next_expect_string_null ()); + if (v != nullptr) + head_branch = *v; + } + else if (c (hs, "head_sha")) head_sha = p.next_expect_string (); else p.next_expect_value_skip (); } @@ -144,7 +149,7 @@ namespace brep operator<< (ostream& os, const gh_check_suite& cs) { os << "node_id: " << cs.node_id - << ", head_branch: " << cs.head_branch + << ", head_branch: " << (cs.head_branch ? *cs.head_branch : "null") << ", head_sha: " << cs.head_sha; return os; @@ -221,7 +226,7 @@ namespace brep while (p.next_expect (event::name, event::end_object)) { if (c (fn, "full_name")) - base_fullname = p.next_expect_string (); + base_path = p.next_expect_string (); else p.next_expect_value_skip (); } @@ -251,7 +256,7 @@ namespace brep while (p.next_expect (event::name, event::end_object)) { if (c (fn, "full_name")) - head_fullname = p.next_expect_string (); + head_path = p.next_expect_string (); else p.next_expect_value_skip (); } @@ -289,12 +294,12 @@ namespace brep : "null") << ", merge_commit_sha:" << pr.merge_commit_sha << ", base: { " - << "full_name: " << pr.base_fullname + << "path: " << pr.base_path << ", ref: " << pr.base_ref << ", sha: " << pr.base_sha << " }" << ", head: { " - << "full_name: " << pr.head_fullname + << "path: " << pr.head_path << ", ref: " << pr.head_ref << ", sha: " << pr.head_sha << " }"; @@ -322,7 +327,7 @@ namespace brep if (c (ni, "node_id")) node_id = p.next_expect_string (); else if (c (nm, "name")) name = p.next_expect_string (); - else if (c (fn, "full_name")) full_name = p.next_expect_string (); + else if (c (fn, "full_name")) path = p.next_expect_string (); else if (c (db, "default_branch")) default_branch = p.next_expect_string (); else if (c (cu, "clone_url")) clone_url = p.next_expect_string (); else p.next_expect_value_skip (); @@ -340,7 +345,7 @@ namespace brep { os << "node_id: " << rep.node_id << ", name: " << rep.name - << ", full_name: " << rep.full_name + << ", path: " << rep.path << ", default_branch: " << rep.default_branch << ", clone_url: " << rep.clone_url; diff --git a/mod/mod-ci-github-gh.hxx b/mod/mod-ci-github-gh.hxx index 3cbdb77..58714be 100644 --- a/mod/mod-ci-github-gh.hxx +++ b/mod/mod-ci-github-gh.hxx @@ -47,7 +47,7 @@ namespace brep struct gh_check_suite { string node_id; - string head_branch; // @@ Make optional (can be NULL). + optional<string> head_branch; string head_sha; explicit @@ -124,7 +124,7 @@ namespace brep { string node_id; string name; - string full_name; + string path; // Repository path (<org>/<repo>) under github.com. string default_branch; string clone_url; diff --git a/mod/mod-ci-github-service-data.cxx b/mod/mod-ci-github-service-data.cxx index ebb692b..11e19ae 100644 --- a/mod/mod-ci-github-service-data.cxx +++ b/mod/mod-ci-github-service-data.cxx @@ -105,17 +105,18 @@ namespace brep timestamp iat_ea, uint64_t iid, string rid, - enum kind k, + kind_type k, bool rr, bool pc, - string hs) + string cs, + string rs) : kind (k), pre_check (pc), re_request (rr), warning_success (ws), installation_access (move (iat_tok), iat_ea), installation_id (iid), repository_node_id (move (rid)), - check_sha (hs), - report_sha (move (hs)) + check_sha (move (cs)), + report_sha (move (rs)) { } @@ -127,9 +128,10 @@ namespace brep timestamp iat_ea, uint64_t iid, string rid, - enum kind k, + kind_type k, bool rr, bool pc, + string cs, string rs, string rcu, uint32_t prn) @@ -140,6 +142,7 @@ namespace brep repository_node_id (move (rid)), repository_clone_url (move (rcu)), pr_number (prn), + check_sha (move (cs)), report_sha (move (rs)) { } diff --git a/mod/mod-ci-github-service-data.hxx b/mod/mod-ci-github-service-data.hxx index 15f8c94..ae1506d 100644 --- a/mod/mod-ci-github-service-data.hxx +++ b/mod/mod-ci-github-service-data.hxx @@ -149,10 +149,11 @@ namespace brep timestamp iat_expires_at, uint64_t installation_id, string repository_node_id, - enum kind kind, + kind_type kind, bool pre_check, bool re_request, - string head_sha); + string check_sha, + string report_sha); // The pull_request constructor. // @@ -161,9 +162,10 @@ namespace brep timestamp iat_expires_at, uint64_t installation_id, string repository_node_id, - enum kind kind, + kind_type kind, bool pre_check, bool re_request, + string check_sha, string report_sha, string repository_clone_url, uint32_t pr_number); diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx index 4694599..6784db8 100644 --- a/mod/mod-ci-github.cxx +++ b/mod/mod-ci-github.cxx @@ -725,14 +725,18 @@ namespace brep // Distinguish between local and remote PRs by comparing the head and base // repositories' paths. // - enum service_data::kind kind ( + service_data::kind_type kind ( pr.pull_request.head_path == pr.pull_request.base_path ? service_data::local : service_data::remote); - // Note that PR rebuilds (re-requested) are handled by check_suite(). + // Note: For remote PRs the check_sha will be set later, in + // build_unloaded_pre_check(). // - // Note that check_sha will be set later, in build_unloaded_pre_check(). + string check_sha (kind == service_data::local ? pr.pull_request.head_sha + : ""); + + // Note that PR rebuilds (re-requested) are handled by check_suite(). // service_data sd (warning_success, move (iat->token), @@ -740,6 +744,7 @@ namespace brep pr.installation.id, move (pr.repository.node_id), kind, true /* pre_check */, false /* re_request */, + move (check_sha), move (pr.pull_request.head_sha) /* report_sha */, move (pr.repository.clone_url), pr.pull_request.number); |