mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-05-12 08:42:01 -04:00
2.0 KiB
2.0 KiB
description
| description |
|---|
| Validate current branch follows feature branch naming conventions |
Validate Feature Branch
Validate that the current Git branch follows the expected feature branch naming conventions.
Prerequisites
- Check if Git is available by running
git rev-parse --is-inside-work-tree 2>/dev/null - If Git is not available, output a warning and skip validation:
[specify] Warning: Git repository not detected; skipped branch validation
Validation Rules
Get the current branch name:
git rev-parse --abbrev-ref HEAD
The branch name must match one of these patterns:
- Sequential:
^[0-9]{3,}-(e.g.,001-feature-name,042-fix-bug,1000-big-feature) - Timestamp:
^[0-9]{8}-[0-9]{6}-(e.g.,20260319-143022-feature-name) - Conventional prefix:
^(feat|fix|chore|docs|build|ci|refactor|test|deps)/(e.g.,feat/add-node-filter,fix/ble-reconnect)
Execution
If on a feature branch (matches any pattern):
- Output:
✓ On feature branch: <branch-name> - For sequential/timestamp branches, check if the corresponding spec directory exists under
specs/:- For sequential branches, look for
specs/<prefix>-*where prefix matches the numeric portion - For timestamp branches, look for
specs/<prefix>-*where prefix matches theYYYYMMDD-HHMMSSportion
- For sequential branches, look for
- For conventional prefix branches, skip spec directory lookup (not spec-driven)
- If spec directory exists:
✓ Spec directory found: <path> - If spec directory missing:
⚠ No spec directory found for prefix <prefix>
If NOT on a feature branch:
- Output:
✗ Not on a feature branch. Current branch: <branch-name> - Output:
Feature branches should be named like: 001-feature-name, feat/feature-name, or 20260319-143022-feature-name
Graceful Degradation
If Git is not installed or the directory is not a Git repository:
- Check the
SPECIFY_FEATUREenvironment variable as a fallback - If set, validate that value against the naming patterns
- If not set, skip validation with a warning