Feature/add cas to hmi#96
Open
samuelh-f wants to merge 3 commits into
Open
Conversation
| - name: Check branches | ||
| shell: bash | ||
| run: | | ||
| head_ref="${{ github.head_ref }}" |
Comment on lines
+12
to
+46
| runs-on: ubuntu-slim | ||
| steps: | ||
| - name: Check branches | ||
| shell: bash | ||
| run: | | ||
| head_ref="${{ github.head_ref }}" | ||
| base_ref="${{ github.base_ref }}" | ||
| is_fork="${{ github.event.pull_request.head.repo.full_name != github.repository }}" | ||
|
|
||
| if [[ "$base_ref" == "main" ]]; then | ||
| # Allow hotfix/* from anywhere (including forks) | ||
| if [[ "$head_ref" == hotfix/* ]]; then | ||
| echo "Allowed: hotfix branch ($head_ref) into main (fork=$is_fork)." | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Allow dev only when NOT from a fork | ||
| if [[ "$head_ref" == "dev" ]]; then | ||
| if [[ "$is_fork" == "true" ]]; then | ||
| echo "Denied: dev branch PRs into main cannot come from forks." | ||
| echo "This PR is from fork repo: ${{ github.event.pull_request.head.repo.full_name }}" | ||
| echo "Branch: $head_ref -> $base_ref" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Allowed: dev branch ($head_ref) into main from same repo." | ||
| exit 0 | ||
| fi | ||
|
|
||
| # Otherwise deny | ||
| echo "Denied: Merge requests to main are only allowed from dev (same repo only) or hotfix/* (forks allowed)." | ||
| echo "This PR is from: $head_ref -> $base_ref" | ||
| echo "Fork PR: $is_fork" | ||
| exit 1 | ||
| fi |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.