chore: add pre-commit hook for conventional commit verification (#619)
This commit is contained in:
parent
95d3e3f940
commit
9b629c609f
1 changed files with 73 additions and 0 deletions
23
crates/rmcp/build.rs
Normal file
23
crates/rmcp/build.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Install git hooks on build
|
||||
fn main() {
|
||||
// Only run in the workspace root (not when building as a dependency)
|
||||
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||
let workspace_root = std::path::Path::new(&manifest_dir)
|
||||
.parent()
|
||||
.and_then(|p| p.parent());
|
||||
|
||||
if let Some(root) = workspace_root {
|
||||
let githooks_dir = root.join(".githooks");
|
||||
let git_dir = root.join(".git");
|
||||
|
||||
// Only configure if we're in the actual workspace (not a dependency)
|
||||
// and git directory exists
|
||||
if githooks_dir.exists() && git_dir.exists() {
|
||||
// Configure git to use our hooks directory
|
||||
let _ = std::process::Command::new("git")
|
||||
.args(["config", "core.hooksPath", ".githooks"])
|
||||
.current_dir(root)
|
||||
.output();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue