diff options
author | Francois Kritzinger <francois@codesynthesis.com> | 2024-10-12 10:52:27 +0200 |
---|---|---|
committer | Francois Kritzinger <francois@codesynthesis.com> | 2024-10-22 07:56:00 +0200 |
commit | d3aa128583eab6afb92df329ca9ea27272394307 (patch) | |
tree | 0d6be76c7ca7d920844b8f8a4e5809dc22643618 | |
parent | da9ed82ac9be5845120b90074113661cf3549c05 (diff) |
Fixes
-rw-r--r-- | mod/mod-ci-github-gq.cxx | 4 | ||||
-rw-r--r-- | mod/mod-ci-github-gq.hxx | 18 | ||||
-rw-r--r-- | mod/mod-ci-github.cxx | 22 |
3 files changed, 13 insertions, 31 deletions
diff --git a/mod/mod-ci-github-gq.cxx b/mod/mod-ci-github-gq.cxx index 83c78dd..1e9af74 100644 --- a/mod/mod-ci-github-gq.cxx +++ b/mod/mod-ci-github-gq.cxx @@ -265,8 +265,8 @@ namespace brep build_state rst (gh_from_status (rcr.status)); // Received state. - // Note that GitHub won't allow us to change a built check run - // to any other state. + // Note that GitHub won't allow us to change a built check run to + // any other state (but all other transitions are allowed). // // @@ Are we handling the case where the resulting state (built) // differs from what we expect? diff --git a/mod/mod-ci-github-gq.hxx b/mod/mod-ci-github-gq.hxx index 1c23a93..ad9797a 100644 --- a/mod/mod-ci-github-gq.hxx +++ b/mod/mod-ci-github-gq.hxx @@ -83,24 +83,6 @@ namespace brep build_state, optional<gq_built_result> = nullopt); - // Fetch a pull request's mergeability from GitHub and return it in first, - // or absent if the merge commit is still being generated. - // - // Return false in second and issue diagnostics if the request failed. - // - struct gq_pr_mergeability - { - // True if the pull request is auto-mergeable; false if it would create - // conflicts. - // - bool mergeable; - - // The ID of the test merge commit. Empty if mergeable is false. - // - string merge_commit_id; - }; - - // 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 diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx index 402fa4a..990db63 100644 --- a/mod/mod-ci-github.cxx +++ b/mod/mod-ci-github.cxx @@ -526,7 +526,7 @@ namespace brep { // Recreate each PR's CI request. // - for (gh_pull_request& pr: *prs) + for (const gh_pull_request& pr: *prs) { service_data prsd (sd.warning_success, sd.installation_access.token, @@ -613,6 +613,8 @@ namespace brep build_state::built, move (br))) { + assert (cr.state == build_state::built); + l3 ([&]{trace << "updated check_run { " << cr << " }";}); } else @@ -745,6 +747,9 @@ namespace brep // // - PR closed @@ TODO // + // Also received if base branch is deleted. (And presumably same for head + // branch.) + // // => pull_request(closed) // // Cancel CI? @@ -939,6 +944,8 @@ namespace brep build_state::built, move (br))) { + assert (cr.state == build_state::built); + return cr; } else @@ -1637,8 +1644,6 @@ namespace brep if (scr->state == build_state::built) return nullptr; - // Don't move from scr because we search sd.check_runs below. - // cr = move (*scr); } else @@ -1823,14 +1828,7 @@ namespace brep } } - // @@ TMP Checking for built only to confirm the create/update - // succeeded. - // - // @@ TODO If cr wasn't in service data then this might be true despite - // the CR not having been created on GH (due to cr.status not being - // initialized and thus containing an indeterminate value). - // - if (cr.state == build_state::built) + if (cr.state_synced) { // Check run was created/updated successfully to built. // @@ -1894,6 +1892,8 @@ namespace brep build_state::built, move (br))) { + assert (cr.state == build_state::built); + l3 ([&]{trace << "updated check_run { " << cr << " }";}); } else |