aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorFrancois Kritzinger <francois@codesynthesis.com>2024-05-28 09:37:16 +0200
committerFrancois Kritzinger <francois@codesynthesis.com>2024-06-05 09:12:46 +0200
commit9d0e65dcf51ac2f7baaf93c277fb2428cb0eb6f2 (patch)
tree4acc78e02d4174d124f624d1b31a573647e4f6d1 /mod
parentcb9a368a433af62613cf52bc9f60cdd037a3c3c5 (diff)
Add fields for PRs to service_data
Diffstat (limited to 'mod')
-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 (