gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

check_branch_name.sh (430B)


      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