github.com/bytedance/sonic@v1.11.7-0.20240517092252-d2edb31b167b/scripts/check_branch_name.sh (about) 1 #!/usr/bin/env bash 2 3 current=$(git status | head -n1 | sed 's/On branch //') 4 name=${1:-$current} 5 if [[ ! $name =~ ^(((opt(imize)?|feat(ure)?|doc|(bug|hot)?fix|test|refact(or)?|ci)/.+)|(main|develop)|(release/.+)|(release-v[0-9]+\.[0-9]+)|(release/v[0-9]+\.[0-9]+\.[0-9]+(-[a-z0-9.]+(\+[a-z0-9.]+)?)?)|revert-[a-z0-9]+)$ ]]; then 6 echo "branch name '$name' is invalid" 7 exit 1 8 else 9 echo "branch name '$name' is valid" 10 fi