From 099344ca38b54ecfc481fc705eaf7db001377915 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Thu, 21 May 2026 15:21:42 +0800 Subject: Restore changes on CI failure after temp commit --- dev_tools/src/bin/ci.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'dev_tools/src/bin') diff --git a/dev_tools/src/bin/ci.rs b/dev_tools/src/bin/ci.rs index a5f581d..554425e 100644 --- a/dev_tools/src/bin/ci.rs +++ b/dev_tools/src/bin/ci.rs @@ -14,10 +14,16 @@ fn main() { run_cmd!("git commit -m \"CI Temp\"").unwrap(); } - if ci().is_ok() { - println_cargo_style!("Done: All check passed!") + if let Err(exit_code) = ci() { + if needs_commit_temp { + run_cmd!("git restore .").unwrap(); + run_cmd!("git reset --soft HEAD~1").unwrap(); + } + exit(exit_code) } + println_cargo_style!("Done: All check passed!"); + let is_worktree_clean = run_cmd!("git diff-index --quiet HEAD --").is_ok(); if !is_worktree_clean { eprintln_cargo_style!("Documents needs refresh!"); -- cgit