Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
# . "$(dirname "$0")/_/husky.sh"

# Validate git branch name
echo "Validating branch name..."
branch_name=$(git symbolic-ref --short HEAD)
branch_name_regex='^((fix|feat|docs|style|refactor|test|chore|perf|task|shared)\/[0-9A-Za-z-]+|misc\/[0-9A-Za-z-]+)$'

if [[ $branch_name =~ $branch_name_regex ]]; then
echo "✅ Branch name is valid."
else
echo -e "\033[0;31m❌ Branch name is invalid. Please follow the format: <type>/<issue_number>-<description>.\033[0m"
echo "Example:"
echo -e "\033[0;32m fix/1234-fix-bug or misc-1234-description\033[0m"
exit 1
fi
34 changes: 34 additions & 0 deletions community/contributing-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ sidebar_position: 2
- [How to set up recode hive:](#how-to-set-up-recode-hive)
- [Environment Setup (for GitHub API access)](#environment-setup-for-github-api-access)
- [Contributing to recode hive](#contributing-to-recode-hive)
- [Branch Validation](#branch-validation)
- [Valid Branch Name Pattern](#valid-branch-name-pattern)
- [Example Branch Names](#example-branch-names)
- [Valid Types](#valid-types)
- [Commit Message Format](#commit-message-format)
- [Example Commit Messages:](#example-commit-messages)
- [Using Commitizen with Husky](#using-commitizen-with-husky)
Expand Down Expand Up @@ -130,6 +134,36 @@ We welcome contributions! Follow these steps to get started.
git checkout -b feature-name
```

## Branch Validation

To ensure that branch names follow our naming conventions, use the following guidelines. The branch name should match the required pattern, and feedback will be provided if it does not.

### Valid Branch Name Pattern

Branch names should follow this regex pattern:

```
^((fix|docs|style|refactor|test|chore|perf|task|shared)\/-[0-9A-Za-z-]+|misc-[0-9A-Za-z-]+)$
```

### Example Branch Names

- `fix/1234-fix-bug`
- `misc-1234-description`

### Valid Types

- **fix:** A bug fix
- **docs:** Documentation only changes
- **style:** Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
- **refactor:** A code change that neither fixes a bug nor adds a feature
- **test:** Adding missing tests or correcting existing tests
- **chore:** Changes to the build process or auxiliary tools and libraries such as documentation generation
- **perf:** A code change that improves performance
- **task:** A task that needs to be done
- **shared:** Shared code or resources
- **misc:** Miscellaneous changes

6. **Commit Your Changes**

```bash
Expand Down
Loading