Prevent Wrong PR Fix
This commit is contained in:
9
.github/workflows/prevent-wrong-pr.yml
vendored
9
.github/workflows/prevent-wrong-pr.yml
vendored
@@ -13,18 +13,15 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Prevent dev merges
|
- name: Prevent dev merges
|
||||||
run: |
|
run: |
|
||||||
echo "${{ github.head_ref }}";
|
if [[ "${{ github.head_ref }}" == "dev" && "${{ github.base_ref }}" == "main" ]]; then
|
||||||
echo "${{ github.base_ref }}";
|
echo "ERROR: Merging 'dev' into 'main' is forbidden!"
|
||||||
if [[ "${{ github.head_ref }}" == "dev" ]]; then
|
|
||||||
echo "ERROR: Merging 'dev' into '${{ github.base_ref }}' is forbidden!"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
- name: Allow only staging into main
|
- name: Allow only staging into main
|
||||||
if: github.base_ref == 'main'
|
if: github.base_ref == 'main'
|
||||||
run: |
|
run: |
|
||||||
echo "${{ github.head_ref }}";
|
|
||||||
echo "${{ github.base_ref }}";
|
|
||||||
if [[ "${{ github.head_ref }}" != "staging" ]]; then
|
if [[ "${{ github.head_ref }}" != "staging" ]]; then
|
||||||
echo "ERROR: Only 'staging' branch is allowed to merge into 'main'. Current: '${{ github.head_ref }}'"
|
echo "ERROR: Only 'staging' branch is allowed to merge into 'main'. Current: '${{ github.head_ref }}'"
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
Reference in New Issue
Block a user