diff options
author | Francois Kritzinger <francois@codesynthesis.com> | 2024-11-14 10:41:19 +0200 |
---|---|---|
committer | Francois Kritzinger <francois@codesynthesis.com> | 2024-11-14 13:18:45 +0200 |
commit | c5c2f6dd99e575b1521bd158bc4cffad50279c72 (patch) | |
tree | 5a7fffd48186171e566859e7f3be46bf59ff9088 | |
parent | 002c76ca8142a812fb5aa6fe7e640bffecaa73c4 (diff) |
Add function gq_update_or_create_check_run()
-rw-r--r-- | mod/mod-ci-github-gq.cxx | 17 | ||||
-rw-r--r-- | mod/mod-ci-github-gq.hxx | 17 |
2 files changed, 34 insertions, 0 deletions
diff --git a/mod/mod-ci-github-gq.cxx b/mod/mod-ci-github-gq.cxx index 0868987..4d1c583 100644 --- a/mod/mod-ci-github-gq.cxx +++ b/mod/mod-ci-github-gq.cxx @@ -573,6 +573,23 @@ namespace brep return r; } + bool + gq_update_or_create_check_run (const basic_mark& error, + check_run& cr, + const string& iat, + const string& rid, + const optional<string>& nid, + const string& hs, + const optional<string>& du, + build_state st, + optional<gq_built_result> br) + { + if (nid) + return gq_update_check_run (error, cr, iat, rid, *nid, du, st, br); + else + return gq_create_check_run (error, cr, iat, rid, hs, du, st, br); + } + // Serialize a GraphQL query that fetches a pull request from GitHub. // static string diff --git a/mod/mod-ci-github-gq.hxx b/mod/mod-ci-github-gq.hxx index 9022fe3..c3be500 100644 --- a/mod/mod-ci-github-gq.hxx +++ b/mod/mod-ci-github-gq.hxx @@ -92,6 +92,23 @@ namespace brep build_state, optional<gq_built_result> = nullopt); + // Update a check run on GitHub if node_id is present, otherwise create a + // new check run associated with head_sha. + // + // This is a wrapper of gq_update_check_run() and gq_create_check_run() for + // convenience. + // + bool + gq_update_or_create_check_run (const basic_mark& error, + check_run& cr, + const string& installation_access_token, + const string& repository_id, + const optional<string>& node_id, + const string& head_sha, + const optional<string>& details_url, + build_state, + optional<gq_built_result> = nullopt); + // Fetch pre-check information for a pull request from GitHub. This // information is used to decide whether or not to CI the PR and is // comprised of the PR's head commit SHA, whether its head branch is behind |