aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/mod-ci-github-gh.cxx23
-rw-r--r--mod/mod-ci-github-gh.hxx2
-rw-r--r--mod/mod-ci-github-gq.cxx11
-rw-r--r--mod/mod-ci-github-gq.hxx1
-rw-r--r--mod/mod-ci-github.cxx2
5 files changed, 13 insertions, 26 deletions
diff --git a/mod/mod-ci-github-gh.cxx b/mod/mod-ci-github-gh.cxx
index dc1447f..28f21f7 100644
--- a/mod/mod-ci-github-gh.cxx
+++ b/mod/mod-ci-github-gh.cxx
@@ -133,23 +133,14 @@ namespace brep
{
p.next_expect (event::begin_object);
- bool ni (false), nm (false), st (false);
-
- while (p.next_expect (event::name, event::end_object))
- {
- auto c = [&p] (bool& v, const char* s)
- {
- return p.name () == s ? (v = true) : false;
- };
-
- if (c (ni, "id")) node_id = p.next_expect_string ();
- else if (c (nm, "name")) name = p.next_expect_string ();
- else if (c (st, "status")) status = p.next_expect_string ();
- }
+ // We always ask for this exact set of fields to be returned in GraphQL
+ // requests.
+ //
+ node_id = p.next_expect_member_string ("id");
+ name = p.next_expect_member_string ("name");
+ status = p.next_expect_member_string ("status");
- if (!ni) missing_member (p, "gh_check_run", "id");
- if (!nm) missing_member (p, "gh_check_run", "name");
- if (!st) missing_member (p, "gh_check_run", "status");
+ p.next_expect (event::end_object);
}
ostream&
diff --git a/mod/mod-ci-github-gh.hxx b/mod/mod-ci-github-gh.hxx
index c7ac00c..3898afd 100644
--- a/mod/mod-ci-github-gh.hxx
+++ b/mod/mod-ci-github-gh.hxx
@@ -40,6 +40,8 @@ namespace brep
// The "check_suite" object within a check_suite webhook event request.
//
+ // @@ TODO Remove unused fields.
+ //
struct gh_check_suite
{
string node_id;
diff --git a/mod/mod-ci-github-gq.cxx b/mod/mod-ci-github-gq.cxx
index 4fe9190..b9b47c3 100644
--- a/mod/mod-ci-github-gq.cxx
+++ b/mod/mod-ci-github-gq.cxx
@@ -51,7 +51,7 @@ namespace brep
// @@ TODO: specify what parse_data may throw (probably only
// invalid_json_input).
//
- // @@ TODO errors comes before data in GitHub's responses.
+ // @@ TODO data comes before errors in GitHub's responses.
//
static void
gq_parse_response (json::parser& p,
@@ -200,7 +200,6 @@ namespace brep
static bool
gq_mutate_check_runs (vector<check_run>& crs,
const string& iat,
- const vector<reference_wrapper<const build>>& bs,
string rq,
build_state st,
const basic_mark& error) noexcept
@@ -230,14 +229,13 @@ namespace brep
{
rcrs = move (rs.check_runs);
- if (rcrs.size () == bs.size ())
+ if (rcrs.size () == crs.size ())
{
for (size_t i (0); i != rcrs.size (); ++i)
{
// Validate the check run in the response against the build.
//
const gh_check_run& rcr (rcrs[i]); // Received check run.
- const build& b (bs[i]);
build_state rst (gh_from_status (rcr.status)); // Received state.
@@ -408,7 +406,7 @@ namespace brep
string rq (gq_serialize_request (
gq_mutation_create_check_runs (rid, hs, bs, st, &bh)));
- return gq_mutate_check_runs (crs, iat, bs, move (rq), st, error);
+ return gq_mutate_check_runs (crs, iat, move (rq), st, error);
}
bool
@@ -435,7 +433,6 @@ namespace brep
const string& iat,
const string& rid,
const string& nid,
- const build& b,
build_state st,
const basic_mark& error)
{
@@ -444,7 +441,7 @@ namespace brep
vector<check_run> crs {move (cr)};
- bool r (gq_mutate_check_runs (crs, iat, {b}, move (rq), st, error));
+ bool r (gq_mutate_check_runs (crs, iat, move (rq), st, error));
cr = move (crs[0]);
diff --git a/mod/mod-ci-github-gq.hxx b/mod/mod-ci-github-gq.hxx
index 994f8d1..fde93c4 100644
--- a/mod/mod-ci-github-gq.hxx
+++ b/mod/mod-ci-github-gq.hxx
@@ -58,7 +58,6 @@ namespace brep
const string& installation_access_token,
const string& repository_id,
const string& node_id,
- const build&,
build_state,
const basic_mark& error);
diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx
index b9b24f4..6db5202 100644
--- a/mod/mod-ci-github.cxx
+++ b/mod/mod-ci-github.cxx
@@ -651,7 +651,6 @@ namespace brep
iat->token,
sd.repository_id,
*cr.node_id,
- b,
st,
error))
{
@@ -757,7 +756,6 @@ namespace brep
iat->token,
sd.repository_id,
pr.first->node_id,
- b,
build_state::building,
error))
{