aboutsummaryrefslogtreecommitdiff
path: root/mod/mod-ci-github-gh.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'mod/mod-ci-github-gh.cxx')
-rw-r--r--mod/mod-ci-github-gh.cxx31
1 files changed, 11 insertions, 20 deletions
diff --git a/mod/mod-ci-github-gh.cxx b/mod/mod-ci-github-gh.cxx
index 5c4809c..7007db8 100644
--- a/mod/mod-ci-github-gh.cxx
+++ b/mod/mod-ci-github-gh.cxx
@@ -20,10 +20,9 @@ namespace brep
case build_state::queued: return "QUEUED";
case build_state::building: return "IN_PROGRESS";
case build_state::built: return "COMPLETED";
- default:
- throw invalid_argument ("invalid build_state value: " +
- to_string (static_cast<int> (st)));
}
+
+ return ""; // Should never reach.
}
// Return the build_state corresponding to a GitHub check run status
@@ -36,19 +35,21 @@ namespace brep
else if (s == "IN_PROGRESS") return build_state::building;
else if (s == "COMPLETED") return build_state::built;
else
- throw invalid_argument ("invalid GitHub check run status: '" + s +
+ throw invalid_argument ("unexpected GitHub check run status: '" + s +
'\'');
}
string
- gh_to_conclusion (result_status rs)
+ gh_to_conclusion (result_status rs, bool warning_success)
{
switch (rs)
{
case result_status::success:
- case result_status::warning:
return "SUCCESS";
+ case result_status::warning:
+ return warning_success ? "SUCCESS" : "FAILURE";
+
case result_status::error:
case result_status::abort:
case result_status::abnormal:
@@ -60,13 +61,9 @@ namespace brep
case result_status::interrupt:
throw invalid_argument ("unexpected result_status value: " +
to_string (rs));
-
- // Invalid value.
- //
- default:
- throw invalid_argument ("invalid result_status value: " +
- to_string (static_cast<int> (rs)));
}
+
+ return ""; // Should never reach.
}
string
@@ -121,7 +118,7 @@ namespace brep
{
p.next_expect (event::begin_object);
- bool ni (false), hb (false), hs (false), bf (false), at (false);
+ bool ni (false), hb (false), hs (false);
// Skip unknown/uninteresting members.
//
@@ -135,16 +132,12 @@ namespace brep
if (c (ni, "node_id")) node_id = p.next_expect_string ();
else if (c (hb, "head_branch")) head_branch = p.next_expect_string ();
else if (c (hs, "head_sha")) head_sha = p.next_expect_string ();
- else if (c (bf, "before")) before = p.next_expect_string ();
- else if (c (at, "after")) after = p.next_expect_string ();
else p.next_expect_value_skip ();
}
if (!ni) missing_member (p, "gh_check_suite", "node_id");
if (!hb) missing_member (p, "gh_check_suite", "head_branch");
if (!hs) missing_member (p, "gh_check_suite", "head_sha");
- if (!bf) missing_member (p, "gh_check_suite", "before");
- if (!at) missing_member (p, "gh_check_suite", "after");
}
ostream&
@@ -152,9 +145,7 @@ namespace brep
{
os << "node_id: " << cs.node_id
<< ", head_branch: " << cs.head_branch
- << ", head_sha: " << cs.head_sha
- << ", before: " << cs.before
- << ", after: " << cs.after;
+ << ", head_sha: " << cs.head_sha;
return os;
}