From 747377fbb9684bd2f5811b080bfbde1fedc59b6c Mon Sep 17 00:00:00 2001 From: Francois Kritzinger Date: Tue, 17 Dec 2024 15:34:05 +0200 Subject: ci-github: Handle forced pushes and branch deletions Cancel CI of the previous head commit in the case of overwritten or deleted history. In the process, move branch push handling from handle_check_suite_request() to handle_branch_push() because GitHub sends a push event instead of a check_suite when a new branch is created so tenant reference counting would not work otherwise. --- mod/mod-ci-github.hxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'mod/mod-ci-github.hxx') diff --git a/mod/mod-ci-github.hxx b/mod/mod-ci-github.hxx index 059801a..4f69f5c 100644 --- a/mod/mod-ci-github.hxx +++ b/mod/mod-ci-github.hxx @@ -82,13 +82,15 @@ namespace brep virtual void init (cli::scanner&); - // Handle the check_suite event `requested` and `rerequested` actions. + // @@ TODO Reorder handlers: push, pull_request, then check_suite. + + // Handle the check_suite event `rerequested` action. // // If warning_success is true, then map result_status::warning to SUCCESS // and to FAILURE otherwise. // bool - handle_check_suite_request (gh_check_suite_event, bool warning_success); + handle_check_suite_rerequest (gh_check_suite_event, bool warning_success); // Handle the check_suite event `completed` action. // @@ -114,6 +116,14 @@ namespace brep bool handle_pull_request (gh_pull_request_event, bool warning_success); + // Handle push events (branch push). + // + // If warning_success is true, then map result_status::warning to SUCCESS + // and to FAILURE otherwise. + // + bool + handle_branch_push (gh_push_event, bool warning_success); + // Build a check run details_url for a build. // string -- cgit v1.1