...

Text file src/github.com/bytedance/sonic/scripts/check_branch_name.sh

Documentation: github.com/bytedance/sonic/scripts

     1#!/usr/bin/env bash
     2
     3current=$(git status | head -n1 | sed 's/On branch //')
     4name=${1:-$current}
     5if [[ ! $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
     8else
     9    echo "branch name '$name' is valid"
    10fi

View as plain text