32 lines
882 B
YAML
32 lines
882 B
YAML
name: PR Rules Enforcement
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- staging
|
|
|
|
jobs:
|
|
check-pr:
|
|
runs-on: ubuntu-latest
|
|
name: Validate Pull Request Sources
|
|
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!"
|
|
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
|
|
fi
|