Skip to content

Add copy to clipboard component #377

Add copy to clipboard component

Add copy to clipboard component #377

name: Branch Protection
on:
pull_request:
types: [opened, edited, synchronize, reopened]
permissions:
contents: read
jobs:
check-branch-name:
name: Validate Branch Name
runs-on: ubuntu-latest
steps:
- name: Check branch naming convention
env:
BRANCH_NAME: ${{ github.head_ref }}
run: |
: "${BRANCH_NAME:?github.head_ref is required}"
# Valid patterns: bugfix/, hotfix/, feature/, infrastructure/, maintenance/, content/
if [[ ! $BRANCH_NAME =~ ^(bugfix|hotfix|feature|infrastructure|maintenance|content|dependabot)/[a-z0-9-]+$ ]]; then
echo "❌ Invalid branch name: $BRANCH_NAME"
echo ""
echo "Branch names must follow one of these patterns:"
echo " - bugfix/<description> (e.g., bugfix/fix-navigation-menu)"
echo " - hotfix/<description> (e.g., hotfix/critical-security-patch)"
echo " - feature/<description> (e.g., feature/add-contact-form)"
echo " - infrastructure/<desc> (e.g., infrastructure/setup-ci)"
echo " - maintenance/<desc> (e.g., maintenance/update-dependencies)"
echo " - content/<description> (e.g., content/update-about-page)"
echo " - dependabot/<description> (machine generated)"
echo ""
echo "Use lowercase letters, numbers, and hyphens only."
exit 1
fi
echo "✅ Branch name is valid: $BRANCH_NAME"
check-pr-target:
name: Verify PR Target
runs-on: ubuntu-latest
steps:
- name: Ensure PR targets main
env:
TARGET_BRANCH: ${{ github.base_ref }}
run: |
: "${TARGET_BRANCH:?github.base_ref is required}"
if [[ "$TARGET_BRANCH" != "main" ]]; then
echo "⚠️ Warning: PR is targeting '$TARGET_BRANCH' instead of 'main'"
echo "This is allowed, but make sure this is intentional."
else
echo "✅ PR correctly targets 'main' branch"
fi