diff options
-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 |