aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancois Kritzinger <francois@codesynthesis.com>2024-05-28 09:37:16 +0200
committerFrancois Kritzinger <francois@codesynthesis.com>2024-10-15 09:05:28 +0200
commit22d1c16a61c0906301d38bd5a34115f2160b0d4a (patch)
tree66ec0aefa5f4c756aab448573d8bceb47a0277f9
parent3a4e5f47b01b551cc8d9be37274337182be16e53 (diff)
Add fields for PRs to service_data
-rw-r--r--mod/mod-ci-github-service-data.cxx29
-rw-r--r--mod/mod-ci-github-service-data.hxx9
-rw-r--r--mod/mod-ci-github.cxx4
3 files changed, 39 insertions, 3 deletions
diff --git a/mod/mod-ci-github-service-data.cxx b/mod/mod-ci-github-service-data.cxx
index 10de076..8c6970c 100644
--- a/mod/mod-ci-github-service-data.cxx
+++ b/mod/mod-ci-github-service-data.cxx
@@ -38,7 +38,17 @@ namespace brep
installation_id =
p.next_expect_member_number<uint64_t> ("installation_id");
+
repository_node_id = p.next_expect_member_string ("repository_node_id");
+
+ {
+ string* s (p.next_expect_member_string_null ("repository_clone_url"));
+ if (s)
+ repository_clone_url = *s;
+ }
+
+ pr_number = p.next_expect_member_number_null<uint32_t> ("pr_number");
+
head_sha = p.next_expect_member_string ("head_sha");
p.next_expect_member_array ("check_runs");
@@ -71,11 +81,15 @@ namespace brep
timestamp iat_ea,
uint64_t iid,
string rid,
- string hs)
+ string hs,
+ optional<string> rcu,
+ optional<uint32_t> prn)
: warning_success (ws),
installation_access (move (iat_tok), iat_ea),
installation_id (iid),
repository_node_id (move (rid)),
+ repository_clone_url (move (rcu)),
+ pr_number (prn),
head_sha (move (hs))
{
}
@@ -101,6 +115,19 @@ namespace brep
s.member ("installation_id", installation_id);
s.member ("repository_node_id", repository_node_id);
+
+ s.member_name ("repository_clone_url");
+ if (repository_clone_url)
+ s.value (*repository_clone_url);
+ else
+ s.value (nullptr);
+
+ s.member_name ("pr_number");
+ if (pr_number)
+ s.value (*pr_number);
+ else
+ s.value (nullptr);
+
s.member ("head_sha", head_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 afcf082..252f992 100644
--- a/mod/mod-ci-github-service-data.hxx
+++ b/mod/mod-ci-github-service-data.hxx
@@ -59,6 +59,11 @@ namespace brep
string repository_node_id; // GitHub-internal opaque repository id.
+ // The following two are only used for pull requests.
+ //
+ optional<string> repository_clone_url;
+ optional<uint32_t> pr_number;
+
// The commit ID the check suite or pull request (and its check runs) are
// associated with. In the case of a pull request this will be
// `pull_request.head.sha`.
@@ -85,7 +90,9 @@ namespace brep
timestamp iat_expires_at,
uint64_t installation_id,
string repository_node_id,
- string head_sha);
+ string head_sha,
+ optional<string> repository_clone_url = nullopt,
+ optional<uint32_t> pr_number = nullopt);
service_data () = default;
diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx
index b09124f..573c1a1 100644
--- a/mod/mod-ci-github.cxx
+++ b/mod/mod-ci-github.cxx
@@ -555,7 +555,9 @@ namespace brep
iat->expires_at,
pr.installation.id,
move (pr.repository.node_id),
- pr.pull_request.head_sha)
+ pr.pull_request.head_sha,
+ pr.repository.clone_url,
+ pr.pull_request.number)
.json ());
optional<string> tid (