Skip to content

Commit 83dbfc2

Browse files
committed
Update branch protection workflow to allow Dependabot branch naming scheme
1 parent e785eb7 commit 83dbfc2

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎.github/workflows/branch-protection.yml‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@ jobs:
1818
run: |
1919
: "${BRANCH_NAME:?github.head_ref is required}"
2020
21-
# Valid patterns: bugfix/, hotfix/, feature/, infrastructure/, maintenance/, content/
22-
if [[ ! $BRANCH_NAME =~ ^(bugfix|hotfix|feature|infrastructure|maintenance|content|dependabot)/[a-z0-9-]+$ ]]; then
21+
HUMAN_BRANCH_REGEX='^(bugfix|hotfix|feature|infrastructure|maintenance|content)/[a-z0-9-]+$'
22+
DEPENDABOT_BRANCH_REGEX='^dependabot/[a-z0-9._/-]+$'
23+
24+
# Human branches use a strict single-segment slug; dependabot branches are machine-generated and may include
25+
# nested path segments, underscores, and dots (for package manager + dependency + version details).
26+
if [[ ! $BRANCH_NAME =~ $HUMAN_BRANCH_REGEX && ! $BRANCH_NAME =~ $DEPENDABOT_BRANCH_REGEX ]]; then
2327
echo "❌ Invalid branch name: $BRANCH_NAME"
2428
echo ""
2529
echo "Branch names must follow one of these patterns:"
@@ -29,9 +33,9 @@ jobs:
2933
echo " - infrastructure/<desc> (e.g., infrastructure/setup-ci)"
3034
echo " - maintenance/<desc> (e.g., maintenance/update-dependencies)"
3135
echo " - content/<description> (e.g., content/update-about-page)"
32-
echo " - dependabot/<description> (machine generated)"
36+
echo " - dependabot/<...> (machine generated; may include '/' '_' '.')"
3337
echo ""
34-
echo "Use lowercase letters, numbers, and hyphens only."
38+
echo "For non-dependabot branches, use lowercase letters, numbers, and hyphens only."
3539
exit 1
3640
fi
3741

0 commit comments

Comments
 (0)