name: Restrict PR source

on:
  pull_request:
    branches:
      - dev

jobs:
  check-source-branch:
    runs-on: ubuntu-latest
    steps:
      - name: Fail if PR is not from main
        run: |
          if [[ "${{ github.head_ref }}" != "main" ]]; then
            echo "Only PRs from main are allowed into dev"
            exit 1
          fi