aboutsummaryrefslogtreecommitdiff
path: root/mod/mod-ci-github-gh.cxx
diff options
context:
space:
mode:
authorFrancois Kritzinger <francois@codesynthesis.com>2024-12-10 16:19:52 +0200
committerFrancois Kritzinger <francois@codesynthesis.com>2024-12-10 16:32:40 +0200
commitd716c64e4501a741ac40b0c2fd0303534a7d7f05 (patch)
tree076dfa192c65a84b2272579a40fb8a564f74e583 /mod/mod-ci-github-gh.cxx
parentc7cb981910fd97128ca5e3f7aa77355a18a56738 (diff)
Handle built notification
Diffstat (limited to 'mod/mod-ci-github-gh.cxx')
-rw-r--r--mod/mod-ci-github-gh.cxx34
1 files changed, 30 insertions, 4 deletions
diff --git a/mod/mod-ci-github-gh.cxx b/mod/mod-ci-github-gh.cxx
index 0bc6595..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,11 +35,38 @@ 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, bool warning_success)
+ {
+ switch (rs)
+ {
+ case result_status::success:
+ return "SUCCESS";
+
+ case result_status::warning:
+ return warning_success ? "SUCCESS" : "FAILURE";
+
+ case result_status::error:
+ case result_status::abort:
+ case result_status::abnormal:
+ return "FAILURE";
+
+ // Valid values we should never encounter.
+ //
+ case result_status::skip:
+ case result_status::interrupt:
+ throw invalid_argument ("unexpected result_status value: " +
+ to_string (rs));
+ }
+
+ return ""; // Should never reach.
+ }
+
+ string
gh_check_run_name (const build& b, const build_queued_hints* bh)
{
string r;