
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
branch-commit-validator
Advanced tools
Simple Git branch and commit validator for consistent naming conventions. Validates format and ensures proper ticket ID patterns without external API dependencies.
A powerful Node.js package that validates Git branch names and commit messages with real-time Jira ticket verification. Now with v2.0.0, it includes comprehensive Jira API integration for enterprise-grade validation.
This enhanced tool maintains consistent Git conventions while ensuring your Jira tickets actually exist, providing real-time validation with intelligent caching and comprehensive error handling.
npm install -g branch-commit-validator
npm install branch-commit-validator
# Validate branch names
validate-git branch feature/SHOP-1234-add-user-authentication
validate-git branch bugfix/SHOP-5678-fix-login-bug
validate-git branch hotfix/SHOP-9012-critical-security-patch
# Validate commit messages
validate-git commit SHOP-1234-add-user-authentication
validate-git commit SHOP-5678-fix-login-bug
# Set up Jira configuration (one-time setup)
export JIRA_API_URL=https://yourcompany.atlassian.net
export JIRA_USERNAME=your-email@company.com
export JIRA_API_TOKEN=your-jira-api-token
# Now validation includes real Jira ticket verification!
validate-git branch feature/SHOP-1234-user-authentication
Output with Jira:
🔍 Validating branch: feature/SHOP-1234-user-authentication
🔍 Validating Jira ticket: SHOP-1234...
✅ Branch name is valid and Jira ticket exists
🎫 Ticket: SHOP-1234
📋 Summary: Implement user authentication system
📊 Status: In Progress
👤 Assignee: John Doe
# Required for Jira integration
JIRA_API_URL=https://yourcompany.atlassian.net
JIRA_USERNAME=your-email@company.com
JIRA_API_TOKEN=your-jira-api-token
# Optional configuration
JIRA_PROJECT_KEYS=SHOP,PROJ,TASK # Multiple projects (default: SHOP)
SKIP_JIRA_VALIDATION=false # Skip Jira validation (default: false)
JIRA_CACHE_TTL=60 # Cache TTL in minutes (default: 60)
# Validate both branch and commit together
validate-git both "feature/SHOP-1234-auth" "SHOP-1234-implement-auth"
# View current Jira configuration
validate-git config
# Check cache statistics
validate-git cache-stats
# Clear ticket cache
validate-git cache-clear
const { validateBranchName, validateCommitMessage } = require('branch-commit-validator');
// Validate branch name
const branchResult = validateBranchName('feature/SHOP-1234-new-feature');
console.log(branchResult.valid); // true/false
console.log(branchResult.message); // validation message
// Validate commit message
const commitResult = validateCommitMessage('SHOP-1234-new-feature');
console.log(commitResult.valid); // true/false
console.log(commitResult.message); // validation message
feature/ - for new featuresbugfix/ - for bug fixeshotfix/ - for critical fixesSHOP-XXXX (where XXXX is a number)^[a-z]+/SHOP-\d+-[a-z0-9-]+$feature/SHOP-1234-add-payment-gatewaybugfix/SHOP-5678-fix-validation-errorhotfix/SHOP-9012-security-patchfeature/add-payment (missing Jira ticket)Feature/SHOP-1234-payment (uppercase prefix)feature/SHOP-1234_payment_gateway (underscores not allowed)feature/SHOP-1234-Payment Gateway (spaces not allowed)SHOP-XXXX-description^SHOP-\d+-[a-z0-9-]+$SHOP-1234-implement-user-registrationSHOP-5678-fix-database-connectionSHOP-9012-update-security-headersSHOP-1234 implement user registration (spaces not allowed)SHOP-1234_implement_user_registration (underscores not allowed)implement user registration (missing Jira ticket)You can integrate this validator with Git hooks for automatic validation:
Create .git/hooks/pre-commit:
#!/bin/bash
branch_name=$(git symbolic-ref --short HEAD)
validate-git branch "$branch_name"
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "Branch name validation failed!"
exit 1
fi
Create .git/hooks/commit-msg:
#!/bin/bash
commit_msg=$(cat $1)
validate-git commit "$commit_msg"
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "Commit message validation failed!"
exit 1
fi
Don't forget to make the hooks executable:
chmod +x .git/hooks/pre-commit
chmod +x .git/hooks/commit-msg
Validates a Git branch name against the defined rules.
Parameters:
branchName (string): The branch name to validateReturns:
valid (boolean): Whether the branch name is validmessage (string): Validation result messageValidates a commit message against the defined rules.
Parameters:
commitMessage (string): The commit message to validateReturns:
valid (boolean): Whether the commit message is validmessage (string): Validation result messageThe CLI exits with the following codes:
0: Validation successful1: Validation failed or invalid usagegit checkout -b feature/SHOP-XXXX-your-featuregit commit -m "SHOP-XXXX-add-your-feature"git push origin feature/SHOP-XXXX-your-featureMIT License - see LICENSE file for details.
Sanjib Roy
If you encounter any issues or have questions, please open an issue on the GitHub repository.
FAQs
Simple Git branch and commit validator for consistent naming conventions. Validates format and ensures proper ticket ID patterns without external API dependencies.
We found that branch-commit-validator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.