odex25_standard/.github/workflows/prevent-invalid-branch-merg...
Workflow config file is invalid. Please check your config file: yaml: line 152: mapping values are not allowed in this context

156 lines
6.2 KiB
YAML

# Author: Ahmad Samir <a.atta@exp-sa.com>
name: Prevent Invalid Merges
on:
pull_request:
branches:
- dev_odex-event
- dev_odex25_accounting
- dev_odex25_base
- dev_odex25_dms
- dev_odex25_fleet
- dev_odex25_hr
- dev_odex25_inventory
- dev_odex25_maintenance
- dev_odex25_mobile
- dev_odex25_pos
- dev_odex25_project
- dev_odex25_purchase
- dev_odex25_realstate
- dev_odex25_sales
- dev_odex25_survey
- dev_odex25_transactions
- dev_odex25_website
- dev_openeducat_erp-14.0.1.0
- dev_odex25_ensan
- dev_odex25_helpdesk
- dev_odex25_donation
- preprod_odex-event
- preprod_odex25_accounting
- preprod_odex25_base
- preprod_odex25_dms
- preprod_odex25_fleet
- preprod_odex25_hr
- preprod_odex25_inventory
- preprod_odex25_maintenance
- preprod_odex25_mobile
- preprod_odex25_pos
- preprod_odex25_project
- preprod_odex25_purchase
- preprod_odex25_realstate
- preprod_odex25_sales
- preprod_odex25_survey
- preprod_odex25_transactions
- preprod_odex25_website
- preprod_openeducat_erp-14.0.1.0
- preprod_odex25_ensan
- preprod_odex25_helpdesk
- preprod_odex25_donation
- master_odex-event
- master_odex25_accounting
- master_odex25_base
- master_odex25_dms
- master_odex25_fleet
- master_odex25_hr
- master_odex25_inventory
- master_odex25_maintenance
- master_odex25_mobile
- master_odex25_pos
- master_odex25_project
- master_odex25_purchase
- master_odex25_realstate
- master_odex25_sales
- master_odex25_survey
- master_odex25_transactions
- master_odex25_website
- master_openeducat_erp-14.0.1.0
- master_odex25_ensan
- master_odex25_helpdesk
- master_odex25_donation
concurrency:
group: prevent-invalid-merges-${{ github.head_ref }}
cancel-in-progress: true
jobs:
validate-merge-source:
runs-on: linting_odex25-standard-modules_runner_app_server
strategy:
matrix:
base_head:
- { base: preprod_odex-event, head: dev_odex-event }
- { base: preprod_odex25_accounting, head: dev_odex25_accounting }
- { base: preprod_odex25_base, head: dev_odex25_base }
- { base: preprod_odex25_dms, head: dev_odex25_dms }
- { base: preprod_odex25_fleet, head: dev_odex25_fleet }
- { base: preprod_odex25_hr, head: dev_odex25_hr }
- { base: preprod_odex25_inventory, head: dev_odex25_inventory }
- { base: preprod_odex25_maintenance, head: dev_odex25_maintenance }
- { base: preprod_odex25_mobile, head: dev_odex25_mobile }
- { base: preprod_odex25_pos, head: dev_odex25_pos }
- { base: preprod_odex25_project, head: dev_odex25_project }
- { base: preprod_odex25_purchase, head: dev_odex25_purchase }
- { base: preprod_odex25_realstate, head: dev_odex25_realstate }
- { base: preprod_odex25_sales, head: dev_odex25_sales }
- { base: preprod_odex25_survey, head: dev_odex25_survey }
- { base: preprod_odex25_transactions, head: dev_odex25_transactions }
- { base: preprod_odex25_website, head: dev_odex25_website }
- { base: preprod_openeducat_erp-14.0.1.0, head: dev_openeducat_erp-14.0.1.0 }
- { base: preprod_odex25_ensan, head: dev_odex25_ensan }
- { base: preprod_odex25_helpdesk, head: dev_odex25_helpdesk }
- { base: preprod_odex25_donation, head: dev_odex25_donation }
- { base: master_odex-event, head: preprod_odex-event }
- { base: master_odex25_accounting, head: preprod_odex25_accounting }
- { base: master_odex25_base, head: preprod_odex25_base }
- { base: master_odex25_dms, head: preprod_odex25_dms }
- { base: master_odex25_fleet, head: preprod_odex25_fleet }
- { base: master_odex25_hr, head: preprod_odex25_hr }
- { base: master_odex25_inventory, head: preprod_odex25_inventory }
- { base: master_odex25_maintenance, head: preprod_odex25_maintenance }
- { base: master_odex25_mobile, head: preprod_odex25_mobile }
- { base: master_odex25_pos, head: preprod_odex25_pos }
- { base: master_odex25_project, head: preprod_odex25_project }
- { base: master_odex25_purchase, head: preprod_odex25_purchase }
- { base: master_odex25_realstate, head: preprod_odex25_realstate }
- { base: master_odex25_sales, head: preprod_odex25_sales }
- { base: master_odex25_survey, head: preprod_odex25_survey }
- { base: master_odex25_transactions, head: preprod_odex25_transactions }
- { base: master_odex25_website, head: preprod_odex25_website }
- { base: master_openeducat_erp-14.0.1.0, head: preprod_openeducat_erp-14.0.1.0 }
- { base: master_odex25_ensan, head: preprod_odex25_ensan }
- { base: master_odex25_helpdesk, head: preprod_odex25_helpdesk }
- { base: master_odex25_donation, head: preprod_odex25_donation }
steps:
- name: Validate branch relationship
run: |
echo "Base branch: ${{ github.base_ref }}"
echo "Head branch: ${{ github.head_ref }}"
if [[ "${{ github.base_ref }}" == "${{ matrix.base_head.base }}" && "${{ github.head_ref }}" != "${{ matrix.base_head.head }}" ]]; then
echo "::error ::You can only merge to '${{ matrix.base_head.base }}' from '${{ matrix.base_head.head }}'!"
exit 1
fi
if [[ "${{ github.base_ref }}" == "master" ]]; then
echo "::error ::Direct merges to 'master' are blocked!"
exit 1
fi
echo "✅ Merge validation passed."
lint:
runs-on: app-sever-project-runner
if: ${{ github.event.pull_request.changed_files > 0 }}
concurrency:
group: linting-${{ github.head_ref }}
cancel-in-progress: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run linter (example: YAML lint)
run: |
echo "Running linter only on changed files..."
# Example: yamllint . --strict
echo "✅ Linting complete."