WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Added the examples for send message #1039

Added the examples for send message

Added the examples for send message #1039

name: Branch Naming Validation
on:
push:
branches-ignore:
- "main"
jobs:
validate-branch-name:
runs-on: ubuntu-latest
steps:
- name: Validate branch naming convention
run: |
BRANCH_NAME="${{ github.ref_name }}"
ACTOR="${{ github.actor }}"
echo "🔍 Validating branch name: $BRANCH_NAME"
echo "👤 Push author: $ACTOR"
# Validate branch naming convention
VALID_NAME=false
ALLOWED_PATTERNS=(
"^feature/" # New product features or major enhancements (org members only)
"^fix/" # Bug fixes, typo corrections, broken links (anyone)
"^docs/" # Documentation improvements and updates (anyone)
"^chore/" # Maintenance tasks, dependency updates (org members only)
"^community/" # General community contributions, examples (anyone)
"^release/" # Release preparation branches (org members only)
"^hotfix/" # Critical fixes for production issues (org members only)
)
for pattern in "${ALLOWED_PATTERNS[@]}"; do
pattern_name=$(echo "$pattern" | sed 's/\^//g' | sed 's/\///g')
if [[ $BRANCH_NAME =~ $pattern ]]; then
VALID_NAME=true
echo "✅ Branch name follows convention: $pattern_name"
break
fi
done
if [ "$VALID_NAME" = false ]; then
echo "❌ Branch name '$BRANCH_NAME' does not follow naming convention."
echo ""
echo "📋 Allowed branch prefixes:"
echo "- feature/ (new product features - org members only)"
echo "- fix/ (bug fixes, typos - anyone)"
echo "- docs/ (documentation improvements - anyone)"
echo "- chore/ (maintenance tasks - org members only)"
echo "- community/ (community contributions - anyone)"
echo "- release/ (release preparation - org members only)"
echo "- hotfix/ (critical fixes - org members only)"
echo ""
echo "💡 Please rename your branch to follow the convention."
exit 1
fi
echo "✅ Branch naming validation successful - push authorized"