aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
Diffstat (limited to 'mod')
-rw-r--r--mod/mod-ci-github-service-data.cxx15
-rw-r--r--mod/mod-ci-github.cxx79
2 files changed, 60 insertions, 34 deletions
diff --git a/mod/mod-ci-github-service-data.cxx b/mod/mod-ci-github-service-data.cxx
index 3af0c71..7ae0b4f 100644
--- a/mod/mod-ci-github-service-data.cxx
+++ b/mod/mod-ci-github-service-data.cxx
@@ -73,7 +73,14 @@ namespace brep
build_state s (to_build_state (p.next_expect_member_string ("state")));
bool ss (p.next_expect_member_boolean<bool> ("state_synced"));
- check_runs.emplace_back (move (bid), move (nm), move (nid), s, ss);
+ optional<result_status> rs;
+ {
+ string* v (p.next_expect_member_string_null ("status"));
+ if (v != nullptr)
+ rs = bbot::to_result_status (*v);
+ }
+
+ check_runs.emplace_back (move (bid), move (nm), move (nid), s, ss, rs);
p.next_expect (event::end_object);
}
@@ -179,6 +186,12 @@ namespace brep
s.member ("state", to_string (cr.state));
s.member ("state_synced", cr.state_synced);
+ s.member_name ("status");
+ if (cr.status)
+ s.value (to_string (*cr.status));
+ else
+ s.value (nullptr);
+
s.end_object ();
}
s.end_array ();
diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx
index 2561bad..82da4f0 100644
--- a/mod/mod-ci-github.cxx
+++ b/mod/mod-ci-github.cxx
@@ -1572,7 +1572,7 @@ namespace brep
if (cr.state == build_state::built)
{
if (conclusion)
- *conclusion |= cr.status
+ *conclusion |= *cr.status;
}
else
conclusion = nullopt;
@@ -1781,46 +1781,59 @@ namespace brep
}
}
- // Update the conclusion check run if all check runs are now built.
- //
- if (cr.state == build_state::built && conclusion)
+ if (cr.state == build_state::built)
{
- assert (sd.conclusion_node_id);
+ // Check run was created/updated successfully to built.
+ //
+ // @@ TMP Feels like this should also be done inside
+ // gq_{create,update}_check_run() -- where cr.state is set if the
+ // create/update succeeds -- but I think we didn't want to pass a
+ // result_status into a gq_ function because converting to a GitHub
+ // conclusion/title/summary is reasonably complicated.
+ //
+ cr.status = b.status;
- // Update the conclusion check run with success.
+ // Update the conclusion check run if all check runs are now built.
//
- result_status rs (*conclusion);
+ if (conclusion)
+ {
+ assert (sd.conclusion_node_id);
- optional<gq_built_result> br (
- gq_built_result (gh_to_conclusion (rs, sd.warning_success),
- circle (rs) + ' ' + ucase (to_string (rs)),
- "All configurations are built"));
+ // Update the conclusion check run with success.
+ //
+ result_status rs (*conclusion);
- check_run cr;
+ optional<gq_built_result> br (
+ gq_built_result (gh_to_conclusion (rs, sd.warning_success),
+ circle (rs) + ' ' + ucase (to_string (rs)),
+ "All configurations are built"));
- // Set some fields for display purposes.
- //
- cr.node_id = *sd.conclusion_node_id;
- cr.name = conclusion_check_run_name;
+ check_run cr;
- if (gq_update_check_run (error,
- cr,
- iat->token,
- sd.repository_node_id,
- *sd.conclusion_node_id,
- nullopt /* details_url */,
- build_state::built,
- move (br)))
- {
- l3 ([&]{trace << "updated check_run { " << cr << " }";});
- }
- else
- {
- // Nothing we can do here except log the error.
+ // Set some fields for display purposes.
//
- error << "check suite " << ts.id
- << ": unable to update conclusion check run "
- << *sd.conclusion_node_id;
+ cr.node_id = *sd.conclusion_node_id;
+ cr.name = conclusion_check_run_name;
+
+ if (gq_update_check_run (error,
+ cr,
+ iat->token,
+ sd.repository_node_id,
+ *sd.conclusion_node_id,
+ nullopt /* details_url */,
+ build_state::built,
+ move (br)))
+ {
+ l3 ([&]{trace << "updated check_run { " << cr << " }";});
+ }
+ else
+ {
+ // Nothing we can do here except log the error.
+ //
+ error << "check suite " << ts.id
+ << ": unable to update conclusion check run "
+ << *sd.conclusion_node_id;
+ }
}
}
}