Skip to content

docs(husky): restructure guide into separate validation documentation #14

docs(husky): restructure guide into separate validation documentation

docs(husky): restructure guide into separate validation documentation #14

name: Branch Name Check
on:
pull_request:
types: [ opened, synchronize, reopened, edited ]
jobs:
validate-branch-name:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check branch name
env:
BRANCH: ${{ github.head_ref }}
run: |
echo "Checking branch name: $BRANCH"
# 보호 브랜치는 검사하지 않음
if [[ "$BRANCH" =~ ^(main|master|develop|staging)$ ]]; then
echo "✓ Protected branch - skipping validation"
exit 0
fi
# 허용된 타입
VALID_TYPES="feature|fix|hotfix|release|refactor|docs|test|chore|style|copilot|claude|dependabot"
# 패턴: type/description 또는 type/domain/description
# 허용: 소문자(a-z), 숫자(0-9), 하이픈(-), 점(.), 언더바(_)
PATTERN="^(${VALID_TYPES})/[a-z0-9][a-z0-9._-]*(/[a-z0-9][a-z0-9._-]*)?$"
if [[ ! "$BRANCH" =~ $PATTERN ]]; then
echo "❌ Invalid branch name: $BRANCH"
exit 1
fi
echo "✓ Branch name is valid"