Download git-hooks/commit-msg from Vishvam10/cloudenv: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/spaces/Vishvam10/cloudenv/resolve/main/git-hooks/commit-msg
- Command line
-
hf download hf://spaces/Vishvam10/cloudenv/git-hooks/commit-msg
-
curl -L -o commit-msg https://huggingface.co/spaces/Vishvam10/cloudenv/resolve/main/git-hooks/commit-msg
1.01 kB
| #!/bin/bash | |
| printf "\nRunning commit-msg hook...\n" >&2 | |
| commit_msg_file="$1" | |
| commit_msg=$(head -n1 "$commit_msg_file") | |
| # Skip merge commits | |
| if [[ "$commit_msg" =~ ^Merge\ ]]; then | |
| echo "Skipping merge commit" | |
| exit 0 | |
| fi | |
| types="add|chore|refactor|test|fix|docs|wip|vapt|debug" | |
| modules="server|common|services|misc|client|inference|actions|providers|engines" | |
| # Pattern: | |
| # type: (module) [optional_submodule] message | |
| pattern="^(${types}): \(${modules}\)( \[[a-z_]+\])? [a-z0-9].+$" | |
| if ! echo "$commit_msg" | grep -Eq "$pattern"; then | |
| cat <<EOF | |
| Invalid commit message format. | |
| Expected: | |
| <type>: (<module>) [optional_submodule] message | |
| Rules: | |
| - type: one of ${types} | |
| - module: one of ${modules} | |
| - optional_submodule: lowercase inside [] | |
| - message: lowercase, no leading caps | |
| Valid examples: | |
| add: (server) [engines] add build engine | |
| fix: (common) dockerfile issue | |
| chore: (client) update models | |
| add: (server) [providers] add s3 reset | |
| EOF | |
| exit 1 | |
| fi | |
| echo "Commit message OK" | |
| exit 0 |