diff options
author | Francois Kritzinger <francois@codesynthesis.com> | 2024-12-09 10:14:34 +0200 |
---|---|---|
committer | Francois Kritzinger <francois@codesynthesis.com> | 2024-12-10 16:34:15 +0200 |
commit | 8ef7e9ca2dc95d1f1b49c032c6ca0355ab88e519 (patch) | |
tree | 10a50b9150f096c9d1164952cc5866ea1e884b1d | |
parent | 4afea23ad12506fe817d350f858477341fb97e7b (diff) |
Handle check suite re-runs
-rw-r--r-- | mod/mod-ci-github.cxx | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx index dbc0c4b..0ddc75d 100644 --- a/mod/mod-ci-github.cxx +++ b/mod/mod-ci-github.cxx @@ -32,8 +32,6 @@ // Will need to extract a few more fields from check_runs, but the layout // is very similar to that of check_suite. // -// - Pull requests. Handle -// // - Choose strong webhook secret (when deploying). // // - Check that delivery UUID has not been received before (replay attack). @@ -283,8 +281,6 @@ namespace brep // @@ There is also check_run even (re-requested by user, either // individual check run or all the failed check runs). // - // @@ There is also the pull_request event. Probably need to handle. - // if (event == "check_suite") { gh_check_suite_event cs; @@ -310,10 +306,8 @@ namespace brep } else if (cs.action == "rerequested") { - // Someone manually requested to re-run the check runs in this check - // suite. Treat as a new request. - // - // @@ This is probably broken. + // Someone manually requested to re-run all the check runs in this + // check suite. Treat as a new request. // return handle_check_suite_request (move (cs), warning_success); } @@ -517,6 +511,7 @@ namespace brep // want to run this code as early as possible to minimize the window of // the user seeing misleading CI results. // + if (cs.action == "requested") { // Fetch open pull requests with the check suite's head branch as base // branch. @@ -562,6 +557,15 @@ namespace brep << cs.check_suite.head_branch; } } + // Cancel existing CI request if this check suite is being re-run. + // + else if (cs.action == "rerequested") + { + const string& nid (cs.check_suite.node_id); + + if (!cancel (error, warn, &trace, *build_db_, "ci-github", nid)) + error << "check suite " << nid << " (re-requested): unable to cancel"; + } // Start CI for the check suite. // @@ -679,6 +683,10 @@ namespace brep // end up in an important branch (as opposed to the head of a feature // branch). // + // Note that in these two cases we are building different commit (the + // head commit vs merge commit). So it's not clear how we can have + // a single check_suite result represent both? + // // Possible solution: ignore all check_suites with non-empty // pull_requests[]. // |