diff options
author | Francois Kritzinger <francois@codesynthesis.com> | 2024-04-18 11:34:55 +0200 |
---|---|---|
committer | Francois Kritzinger <francois@codesynthesis.com> | 2024-10-15 09:05:28 +0200 |
commit | df63768ffae86a8b5784efa6a502a81ad1077985 (patch) | |
tree | c03c00700db4cf0a4e2a1c547d7c5f894dbb1ae4 /mod/mod-ci-github-gh.cxx | |
parent | 4e8eeae58e94ac17301c432d9de80760ef7593b3 (diff) |
Post-review changes
Diffstat (limited to 'mod/mod-ci-github-gh.cxx')
-rw-r--r-- | mod/mod-ci-github-gh.cxx | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/mod/mod-ci-github-gh.cxx b/mod/mod-ci-github-gh.cxx index 5664a7a..4e5ae9b 100644 --- a/mod/mod-ci-github-gh.cxx +++ b/mod/mod-ci-github-gh.cxx @@ -7,9 +7,8 @@ namespace brep { - static const string gh_status[] {"QUEUED", "IN_PROGRESS", "COMPLETED"}; - - // Return the GitHub check run status corresponding to a build_state. + // Return the GitHub check run status corresponding to a build_state. Throw + // invalid_argument if the build_state value was invalid. // string gh_to_status (build_state st) @@ -18,8 +17,11 @@ namespace brep // switch (st) { - case build_state::queued: return "QUEUED"; - // @@ TODO: complete. + 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 (st)); } } @@ -302,7 +304,7 @@ namespace brep }; if (c (tk, "token")) token = p.next_expect_string (); - else if (c (ea, "expires_at")) expires_at = from_iso8601 (p.next_expect_string ()); + else if (c (ea, "expires_at")) expires_at = gh_from_iso8601 (p.next_expect_string ()); else p.next_expect_value_skip (); } @@ -326,7 +328,7 @@ namespace brep } string - to_iso8601 (timestamp t) + gh_to_iso8601 (timestamp t) { return butl::to_string (t, "%Y-%m-%dT%TZ", @@ -335,7 +337,7 @@ namespace brep } timestamp - from_iso8601 (const string& s) + gh_from_iso8601 (const string& s) { return butl::from_string (s.c_str (), "%Y-%m-%dT%TZ", false /* local */); } |