Release: merge development into beta #176
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 Policy | |
| on: | |
| pull_request: | |
| branches: [main, beta, development] | |
| jobs: | |
| check-source-branch: | |
| name: Branch Policy Check | |
| runs-on: ubuntu-latest | |
| # Observed over 31 runs: max 0.1 min. | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Verify source branch | |
| run: | | |
| SOURCE="${{ github.head_ref }}" | |
| TARGET="${{ github.base_ref }}" | |
| # hotfix/* is always allowed | |
| if [[ "$SOURCE" == hotfix/* ]]; then | |
| echo "✅ Hotfix branch '$SOURCE' is allowed to merge into '$TARGET'." | |
| exit 0 | |
| fi | |
| case "$TARGET" in | |
| main) | |
| if [ "$SOURCE" = "beta" ]; then | |
| echo "✅ Branch '$SOURCE' is allowed to merge into main." | |
| else | |
| echo "❌ Branch '$SOURCE' is not allowed to merge into main." | |
| echo "Only 'beta' and 'hotfix/*' branches can be merged into main." | |
| exit 1 | |
| fi | |
| ;; | |
| beta) | |
| if [ "$SOURCE" = "development" ]; then | |
| echo "✅ Branch '$SOURCE' is allowed to merge into beta." | |
| else | |
| echo "❌ Branch '$SOURCE' is not allowed to merge into beta." | |
| echo "Only 'development' and 'hotfix/*' branches can be merged into beta." | |
| exit 1 | |
| fi | |
| ;; | |
| development) | |
| # Allow Conventional-Commits style prefixes plus Dependabot. | |
| if [[ "$SOURCE" == feature/* \ | |
| || "$SOURCE" == feat/* \ | |
| || "$SOURCE" == fix/* \ | |
| || "$SOURCE" == chore/* \ | |
| || "$SOURCE" == refactor/* \ | |
| || "$SOURCE" == docs/* \ | |
| || "$SOURCE" == test/* \ | |
| || "$SOURCE" == perf/* \ | |
| || "$SOURCE" == build/* \ | |
| || "$SOURCE" == ci/* \ | |
| || "$SOURCE" == style/* \ | |
| || "$SOURCE" == spec/* \ | |
| || "$SOURCE" == dependabot/* ]]; then | |
| echo "✅ Branch '$SOURCE' is allowed to merge into development." | |
| else | |
| echo "❌ Branch '$SOURCE' is not allowed to merge into development." | |
| echo "Allowed prefixes: feature/*, feat/*, fix/*, chore/*, refactor/*, docs/*, test/*, perf/*, build/*, ci/*, style/*, spec/*, hotfix/*, dependabot/*." | |
| exit 1 | |
| fi | |
| ;; | |
| *) | |
| echo "✅ No branch policy for target '$TARGET'." | |
| ;; | |
| esac |