@@ -29,6 +29,7 @@ fn handle_ci_github(args: &[String]) {
2929 // Subcommands: install | (default: run in CI context)
3030 match args[ 0 ] . as_str ( ) {
3131 "run" => {
32+ let no_cleanup = args[ 1 ..] . iter ( ) . any ( |a| a == "--no-cleanup" ) ;
3233 let ci_context = get_github_ci_context ( ) ;
3334 match ci_context {
3435 Ok ( Some ( ci_context) ) => {
@@ -37,11 +38,15 @@ fn handle_ci_github(args: &[String]) {
3738 eprintln ! ( "Error running GitHub CI context: {}" , e) ;
3839 std:: process:: exit ( 1 ) ;
3940 }
40- if let Err ( e) = ci_context. teardown ( ) {
41- eprintln ! ( "Error tearing down GitHub CI context: {}" , e) ;
42- std:: process:: exit ( 1 ) ;
41+ if !no_cleanup {
42+ if let Err ( e) = ci_context. teardown ( ) {
43+ eprintln ! ( "Error tearing down GitHub CI context: {}" , e) ;
44+ std:: process:: exit ( 1 ) ;
45+ }
46+ debug_log ( "GitHub CI context teared down" ) ;
47+ } else {
48+ debug_log ( "Skipping teardown (--no-cleanup)" ) ;
4349 }
44- debug_log ( "GitHub CI context teared down" ) ;
4550 std:: process:: exit ( 0 ) ;
4651 }
4752 Err ( e) => {
@@ -185,7 +190,7 @@ fn print_ci_help_and_exit() -> ! {
185190 eprintln ! ( "" ) ;
186191 eprintln ! ( "Subcommands:" ) ;
187192 eprintln ! ( " github GitHub CI" ) ;
188- eprintln ! ( " run Run GitHub CI in current repo" ) ;
193+ eprintln ! ( " run [--no-cleanup] Run GitHub CI in current repo" ) ;
189194 eprintln ! ( " install Install/update workflow in current repo" ) ;
190195 eprintln ! ( " local Run CI locally by event name and flags" ) ;
191196 eprintln ! ( " Usage: git-ai ci local <event> [flags]" ) ;
@@ -214,7 +219,8 @@ fn print_ci_github_help_and_exit() -> ! {
214219 eprintln ! ( "Usage: git-ai ci github <subcommand> [args...]" ) ;
215220 eprintln ! ( "" ) ;
216221 eprintln ! ( "Subcommands:" ) ;
217- eprintln ! ( " run Run GitHub CI in current repo" ) ;
218- eprintln ! ( " install Install/update workflow in current repo" ) ;
222+ eprintln ! ( " run [--no-cleanup] Run GitHub CI in current repo" ) ;
223+ eprintln ! ( " --no-cleanup Skip teardown after run" ) ;
224+ eprintln ! ( " install Install/update workflow in current repo" ) ;
219225 std:: process:: exit ( 1 ) ;
220226}
0 commit comments