BranchName=$1
RegEx="(refs\/heads\/)?([Rr]elease|[Dd]ev|hotfix)(-v[\d]+\.[\d]+\.[\d]+)(--)([\w][\w-]+)(--)[\d]+$"
echo "Branch name for test is: ${BranchName}"
if [[ ${BranchName} =~ ${RegEx} ]]; then
echo "Branch name IN correct format: ${BranchName}"
exit 0
else
echo "Branch name not in correct format: ${BranchName}"
exit 1
fi
string for testing: "refs/heads/release-v8.1.7--testBranchRename--323323"
REGEX correct according https://rubular.com/
Aucun commentaire:
Enregistrer un commentaire