Skip to content

chore(deps): bump actions/setup-java from 4 to 5 #178

chore(deps): bump actions/setup-java from 4 to 5

chore(deps): bump actions/setup-java from 4 to 5 #178

# SPDX-License-Identifier: Apache-2.0
# © Crown Copyright 2025. This work has been developed by the National Digital Twin Programme and is legally attributed to the Department for Business and Trade (UK) as the governing entity.
name: GitFlow - PR Target Check
on:
pull_request:
types: [ opened, synchronize, reopened, edited ]
jobs:
pr-target-check:
runs-on: ubuntu-latest
steps:
- name: Check merge target
run: |
BASE_BRANCH="${{ github.base_ref }}"
HEAD_BRANCH="${{ github.head_ref }}"
# Allow merging feature, hotfix, or bugfix into develop
if [[ "$HEAD_BRANCH" =~ ^(feature/|hotfix/|bugfix/) && "$BASE_BRANCH" == "develop" ]]; then
echo "✅ Allowed: $HEAD_BRANCH → $BASE_BRANCH"
exit 0
fi
# Verify Dependabot branches
if [[ "$HEAD_BRANCH" =~ ^(dependabot/) && "$BASE_BRANCH" == "develop" ]]; then
echo "✅ Not GitFlow but allowed: $HEAD_BRANCH → $BASE_BRANCH"
exit 0
fi
# Allow merging release into main
if [[ "$HEAD_BRANCH" =~ ^release/.*$ && "$BASE_BRANCH" == "main" ]]; then
echo "✅ Allowed: $HEAD_BRANCH → $BASE_BRANCH"
exit 0
fi
# If none of the above conditions match, block the PR
echo "❌ Error: Invalid PR - '$HEAD_BRANCH' cannot be merged into '$BASE_BRANCH'."
echo "✅ Allowed merges:"
echo " - feature/*, hotfix/*, bugfix/* → develop"
echo " - release/* → main"
exit 1