aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorFrancois Kritzinger <francois@codesynthesis.com>2024-10-24 10:37:55 +0200
committerFrancois Kritzinger <francois@codesynthesis.com>2024-10-24 13:19:55 +0200
commita5fab430e168c25bea0bb6a5a00dbd4c6bf0e938 (patch)
treedd75d2afac017f5aa17584206ca8b8e8422af324 /mod
parent1fdb3a6deb95b9fe5a29399007e4eb374c12dbf6 (diff)
Determine whether PR is local or remote
Diffstat (limited to 'mod')
-rw-r--r--mod/mod-ci-github.cxx17
1 files changed, 11 insertions, 6 deletions
diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx
index 058bd48..5c9bdc4 100644
--- a/mod/mod-ci-github.cxx
+++ b/mod/mod-ci-github.cxx
@@ -698,13 +698,20 @@ namespace brep
// job might actually still be relevant (in both local and remote PR
// cases).
- // @@ TMP We can already determine whether the PR is local or remote so we
- // could pass `kind` to the service_data constructor. Let's do.
-
// @@ TODO: what happens when the entire PR build is re-requested?
// @@ TODO Serialize the new service_data fields!
//
+
+ // Distinguish between local and remote PRs by comparing the head and base
+ // repositories' full names (which look like
+ // <username>/<repository-name>).
+ //
+ enum service_data::kind kind (pr.pull_request.head_fullname ==
+ pr.pull_request.base_fullname
+ ? service_data::local
+ : service_data::remote);
+
// Note that check_sha will be set later, in build_unloaded_pre_check().
//
service_data sd (warning_success,
@@ -712,9 +719,7 @@ namespace brep
iat->expires_at,
pr.installation.id,
move (pr.repository.node_id),
- service_data::local, // @@ TODO
- true /* pre_check */,
- false /* re_request */,
+ kind, true /* pre_check */, false /* re_request */,
move (pr.pull_request.head_sha) /* report_sha */,
move (pr.repository.clone_url),
pr.pull_request.number);