Docs/js sdk agentic #1949
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Branch Name Validation | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| jobs: | |
| validate-branch-name: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check branch name | |
| run: | | |
| BRANCH_NAME="${{ github.head_ref }}" | |
| # Define allowed patterns | |
| 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) | |
| ) | |
| # Check if branch name matches any allowed pattern | |
| VALID=false | |
| for pattern in "${ALLOWED_PATTERNS[@]}"; do | |
| if [[ $BRANCH_NAME =~ $pattern ]]; then | |
| VALID=true | |
| break | |
| fi | |
| done | |
| if [ "$VALID" = false ]; then | |
| echo "❌ Branch name '$BRANCH_NAME' does not follow naming convention." | |
| echo "" | |
| echo "Please use one of the following prefixes:" | |
| echo "" | |
| echo "📋 Available to ALL contributors:" | |
| echo "- fix/ (for bug fixes, typos, broken links)" | |
| echo "- docs/ (for documentation improvements)" | |
| echo "- community/ (for examples, guides, general contributions)" | |
| echo "" | |
| echo "🔒 Restricted to CometChat org members only:" | |
| echo "- feature/ (for new product features or major enhancements)" | |
| echo "- release/ (for release preparation)" | |
| echo "- chore/ (for maintenance tasks, dependency updates)" | |
| echo "- hotfix/ (for critical production fixes)" | |
| echo "" | |
| echo "Examples:" | |
| echo "- fix/typo-in-getting-started" | |
| echo "- docs/clarify-authentication-steps" | |
| echo "- community/add-react-example" | |
| echo "" | |
| echo "See .github/branch-naming-convention.md for more details." | |
| exit 1 | |
| else | |
| echo "✅ Branch name '$BRANCH_NAME' follows naming convention." | |
| fi |