diff options
author | Francois Kritzinger <francois@codesynthesis.com> | 2024-10-29 16:54:26 +0200 |
---|---|---|
committer | Francois Kritzinger <francois@codesynthesis.com> | 2024-12-10 16:34:15 +0200 |
commit | e4447a19e8a58c16a9c31d13c5ed2c26b30a3550 (patch) | |
tree | 2b540df614c8a1ea7aa80c296df6129ffa7cf4ad /mod/mod-ci-github-gq.hxx | |
parent | 554d116a7b49eba5dd64ceb61b2f3b922f21c100 (diff) |
Implement build_unloaded_pre_check() and build_unloaded_load()
Diffstat (limited to 'mod/mod-ci-github-gq.hxx')
-rw-r--r-- | mod/mod-ci-github-gq.hxx | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/mod/mod-ci-github-gq.hxx b/mod/mod-ci-github-gq.hxx index ad9797a..72283ee 100644 --- a/mod/mod-ci-github-gq.hxx +++ b/mod/mod-ci-github-gq.hxx @@ -83,10 +83,15 @@ namespace brep build_state, optional<gq_built_result> = nullopt); - // Fetch a pull request's mergeability from GitHub. Return absent value if - // the merge commit is still being generated. Return empty string if the - // pull request is not auto-mergeable. Otherwise return the test merge - // commit id. + // 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 + // its base branch, and its test merge commit SHA. + // + // Return absent value if the merge commit is still being generated (which + // means PR head branch behindness is not yet known either). See the + // gq_pr_pre_check struct's member comments for non-absent return value + // semantics. // // Issue diagnostics and return absent if the request failed (which means it // will be treated by the caller as still being generated). @@ -95,22 +100,27 @@ namespace brep // merge commit. (For details see // https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests.) // - optional<string> - gq_pull_request_mergeable (const basic_mark& error, - const string& installation_access_token, - const string& node_id); + struct gq_pr_pre_check_info + { + // The PR head commit id. + // + string head_sha; - // Fetch the last 100 open pull requests with the specified base branch from - // the repository with the specified node ID. - // - // Issue diagnostics and return nullopt if the repository was not found or - // an error occurred. - // - optional<vector<gh_pull_request>> - gq_fetch_open_pull_requests (const basic_mark& error, - const string& installation_access_token, - const string& repository_node_id, - const string& base_branch); + // True if the PR's head branch is behind its base branch. + // + bool behind; + + // The commit id of the test merge commit. Absent if behind or the PR is + // not auto-mergeable. + // + optional<string> merge_commit_sha; + }; + + optional<gq_pr_pre_check_info> + gq_fetch_pull_request_pre_check_info ( + const basic_mark& error, + const string& installation_access_token, + const string& node_id); } #endif // MOD_MOD_CI_GITHUB_GQ_HXX |