Release: Bump version to v0.2.0 stable #23
Workflow file for this run
This file contains 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 Protection' | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
protect-main-branch: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Ensure PRs are only from allowed branches | |
run: | | |
# Check if the target branch is 'main' | |
if [[ "${GITHUB_BASE_REF}" == "main" ]]; then | |
# If targeting 'main', ensure source branch is either 'release/*' or 'hotfix/*' | |
if ! [[ ${GITHUB_HEAD_REF} =~ ^(release/|hotfix/).+ ]]; then | |
echo "Error: Pull requests to main can only be from 'release/*' or 'hotfix/*' branches." | |
exit 1 | |
else | |
echo "Pull request to main from allowed branch '${GITHUB_HEAD_REF}'." | |
fi | |
else | |
# If not targeting 'main', skip the check and pass | |
echo "Pull request is not targeting 'main'; no protection checks required." | |
fi |