@@ -145,15 +145,45 @@ jobs:
145145 #BRANCH_NAME="${GITHUB_HEAD_REF}"
146146 BRANCH_NAME="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
147147 echo "Validating branch name: $BRANCH_NAME"
148+
149+ # Read allowed branch patterns from .releaserc.json
150+ ALLOWED_BRANCHES=$(jq -r '.branches[].name' .releaserc.json)
151+
152+ VALID=false
153+ for pattern in $ALLOWED_BRANCHES; do
154+ # Convert wildcard * into regex
155+ REGEX="^${pattern//\*/.*}$"
156+ if [[ "$BRANCH_NAME" =~ $REGEX ]]; then
157+ VALID=true
158+ break
159+ fi
160+ done
161+
162+ # Always allow dependabot branches for CI
163+ # Semver will ignore the branch but will bump the collected dependabot changes branch
164+ if [[ "$BRANCH_NAME" =~ ^dependabot/ ]]; then
165+ echo "✅ Branch is a dependabot branch its not for release or versioning but for merging into the dependabot collection branch"
166+ VALID=true
167+ fi
148168
149- if [[ "$BRANCH_NAME " =~ ^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|sample|security|config|bugfix|hotfix)-[a-zA-Z0-9._/-]+$ ]] || [[ "$BRANCH_NAME" == "master" ] ]; then
169+ if [ "$VALID " = true ]; then
150170 echo "✅ Branch name is valid"
151171 else
152172 echo "❌ Invalid branch name: $BRANCH_NAME"
153- echo "Branch names must follow one of the allowed prefixes :"
154- echo " build-*, feat-*, fix-*, bugfix-*, hotfix-*, build-*, chore-*, ci-*, docs-*, perf-*, refactor-*, revert-*, style-*, test-*, sample-*, security-*, config-*, bugfix-*, hotfix-* "
173+ echo "Allowed branch patterns :"
174+ echo "$ALLOWED_BRANCHES "
155175 exit 1
156176 fi
177+
178+ # qqqq drop
179+ # if [[ "$BRANCH_NAME" =~ ^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|sample|security|config|bugfix|hotfix)-[a-zA-Z0-9._/-]+$ ]] || [[ "$BRANCH_NAME" == "master" ]]; then
180+ # echo "✅ Branch name is valid"
181+ # else
182+ # echo "❌ Invalid branch name: $BRANCH_NAME"
183+ # echo "Branch names must follow one of the allowed prefixes:"
184+ # echo " build-*, feat-*, fix-*, bugfix-*, hotfix-*, build-*, chore-*, ci-*, docs-*, perf-*, refactor-*, revert-*, style-*, test-*, sample-*, security-*, config-*, bugfix-*, hotfix-*"
185+ # exit 1
186+ # fi
157187
158188
159189 reuseable-ci-checks-commitlint :
0 commit comments