diff options
author | Francois Kritzinger <francois@codesynthesis.com> | 2024-10-24 10:51:56 +0200 |
---|---|---|
committer | Francois Kritzinger <francois@codesynthesis.com> | 2024-10-24 13:19:55 +0200 |
commit | 1fdb3a6deb95b9fe5a29399007e4eb374c12dbf6 (patch) | |
tree | 6c93f5fce94ec23448d422d9c98b5863ca0dd7e3 /mod/mod-ci-github-gh.cxx | |
parent | 6199917a8537a3c1f06ac6345d06a283c101fc6a (diff) |
gh_pull_request: Extract {head,base}.repo.full_name
Was previously extracting {head,base}.label but that seems too vaguely defined
and transient in nature to be relied upon to fulle distinguish the head and
base repositories.
Diffstat (limited to 'mod/mod-ci-github-gh.cxx')
-rw-r--r-- | mod/mod-ci-github-gh.cxx | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/mod/mod-ci-github-gh.cxx b/mod/mod-ci-github-gh.cxx index 4ad8d32..92b2970 100644 --- a/mod/mod-ci-github-gh.cxx +++ b/mod/mod-ci-github-gh.cxx @@ -208,37 +208,61 @@ namespace brep { p.next_expect (event::begin_object); - bool l (false), r (false), s (false); + bool r (false), s (false), rp (false), fn (false); while (p.next_expect (event::name, event::end_object)) { - if (c (l, "label")) base_label = p.next_expect_string (); - else if (c (r, "ref")) base_ref = p.next_expect_string (); + if (c (r, "ref")) base_ref = p.next_expect_string (); else if (c (s, "sha")) base_sha = p.next_expect_string (); + else if (c (rp, "repo")) + { + p.next_expect (event::begin_object); + + while (p.next_expect (event::name, event::end_object)) + { + if (c (fn, "full_name")) + base_fullname = p.next_expect_string (); + else + p.next_expect_value_skip (); + } + } else p.next_expect_value_skip (); } - if (!l) missing_member (p, "gh_pull_request.base", "label"); - if (!r) missing_member (p, "gh_pull_request.base", "ref"); - if (!s) missing_member (p, "gh_pull_request.base", "sha"); + if (!r) missing_member (p, "gh_pull_request.base", "ref"); + if (!s) missing_member (p, "gh_pull_request.base", "sha"); + if (!rp) missing_member (p, "gh_pull_request.base", "repo"); + if (!fn) missing_member (p, "gh_pull_request.base.repo", "full_name"); } else if (c (hd, "head")) { p.next_expect (event::begin_object); - bool l (false), r (false), s (false); + bool r (false), s (false), rp (false), fn (false); while (p.next_expect (event::name, event::end_object)) { - if (c (l, "label")) head_label = p.next_expect_string (); - else if (c (r, "ref")) head_ref = p.next_expect_string (); + if (c (r, "ref")) head_ref = p.next_expect_string (); else if (c (s, "sha")) head_sha = p.next_expect_string (); + else if (c (rp, "repo")) + { + p.next_expect (event::begin_object); + + while (p.next_expect (event::name, event::end_object)) + { + if (c (fn, "full_name")) + head_fullname = p.next_expect_string (); + else + p.next_expect_value_skip (); + } + } else p.next_expect_value_skip (); } - if (!l) missing_member (p, "gh_pull_request.head", "label"); - if (!r) missing_member (p, "gh_pull_request.head", "ref"); - if (!s) missing_member (p, "gh_pull_request.head", "sha"); + if (!r) missing_member (p, "gh_pull_request.head", "ref"); + if (!s) missing_member (p, "gh_pull_request.head", "sha"); + if (!rp) missing_member (p, "gh_pull_request.head", "repo"); + if (!fn) missing_member (p, "gh_pull_request.head.repo", "full_name"); } else p.next_expect_value_skip (); } @@ -265,12 +289,12 @@ namespace brep : "null") << ", merge_commit_sha:" << pr.merge_commit_sha << ", base: { " - << "label: " << pr.base_label + << "full_name: " << pr.base_fullname << ", ref: " << pr.base_ref << ", sha: " << pr.base_sha << " }" << ", head: { " - << "label: " << pr.head_label + << "full_name: " << pr.head_fullname << ", ref: " << pr.head_ref << ", sha: " << pr.head_sha << " }"; |