Skip to content

Commit 8689940

Browse files
committed
feat: add auto signoff detection from environment variable ✍️
- Implement detection of GIT_AUTO_SIGNOFF environment variable - Enable signoff if environment variable is set to true or 1 - Update logic to combine CLI signoff option with environment variable check Signed-off-by: mingcheng <mingcheng@apache.org>
1 parent 7007df9 commit 8689940

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* File Created: 2025-03-01 17:17:30
1010
*
1111
* Modified By: mingcheng (mingcheng@apache.org)
12-
* Last Modified: 2025-07-11 17:39:40
12+
* Last Modified: 2025-07-11 17:42:00
1313
*/
1414

1515
use aigitcommit::cli::Cli;
@@ -127,8 +127,13 @@ async fn main() -> std::result::Result<(), Box<dyn Error>> {
127127
}
128128
};
129129

130+
// Detect auto signoff from environment variable
131+
let need_signoff_from_env = env::var("GIT_AUTO_SIGNOFF")
132+
.map(|v| v == "1" || v.eq_ignore_ascii_case("true"))
133+
.unwrap_or(false);
134+
130135
// If the --signoff option is enabled, add signoff to the commit message
131-
if cli.signoff {
136+
if cli.signoff || need_signoff_from_env {
132137
trace!("signoff option is enabled, will add signoff to the commit message");
133138
let (author_name, author_email) = (
134139
repository.get_author_name()?,

0 commit comments

Comments
 (0)