aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorFrancois Kritzinger <francois@codesynthesis.com>2024-10-24 10:51:56 +0200
committerFrancois Kritzinger <francois@codesynthesis.com>2024-10-24 13:19:55 +0200
commit1fdb3a6deb95b9fe5a29399007e4eb374c12dbf6 (patch)
tree6c93f5fce94ec23448d422d9c98b5863ca0dd7e3 /mod
parent6199917a8537a3c1f06ac6345d06a283c101fc6a (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')
-rw-r--r--mod/mod-ci-github-gh.cxx52
-rw-r--r--mod/mod-ci-github-gh.hxx14
2 files changed, 44 insertions, 22 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
<< " }";
diff --git a/mod/mod-ci-github-gh.hxx b/mod/mod-ci-github-gh.hxx
index 2b77aeb..48564b0 100644
--- a/mod/mod-ci-github-gh.hxx
+++ b/mod/mod-ci-github-gh.hxx
@@ -81,14 +81,12 @@ namespace brep
optional<bool> mergeable;
string merge_commit_sha;
- // @@ TODO Remove label if unused.
- string base_label; // Name distinguishing the base from the head.
- string base_ref;
- string base_sha;
-
- // @@ TODO Remove label if unused.
- string head_label; // Name distinguishing the head from the base.
- string head_ref;
+ string base_fullname;
+ string base_ref; // @@ TODO Remove if remains unused.
+ string base_sha; // @@ TODO Remove if remains unused.
+
+ string head_fullname;
+ string head_ref; // @@ TODO Remove if remains unused.
string head_sha;
explicit