Prevent Wrong PR Fix

This commit is contained in:
Moritz Utcke
2025-08-02 13:57:34 -04:00
parent 249caafddb
commit f29aaa2170

View File

@@ -13,18 +13,15 @@ jobs:
steps:
- name: Prevent dev merges
run: |
echo "${{ github.head_ref }}";
echo "${{ github.base_ref }}";
if [[ "${{ github.head_ref }}" == "dev" ]]; then
echo "ERROR: Merging 'dev' into '${{ github.base_ref }}' is forbidden!"
if [[ "${{ github.head_ref }}" == "dev" && "${{ github.base_ref }}" == "main" ]]; then
echo "ERROR: Merging 'dev' into 'main' is forbidden!"
exit 1
fi
- name: Allow only staging into main
if: github.base_ref == 'main'
run: |
echo "${{ github.head_ref }}";
echo "${{ github.base_ref }}";
if [[ "${{ github.head_ref }}" != "staging" ]]; then
echo "ERROR: Only 'staging' branch is allowed to merge into 'main'. Current: '${{ github.head_ref }}'"
exit 1