# This is a basic workflow to help you get started with Actions

name: No PRs to Release Branches

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the v1.x branch
  pull_request:
    types: [opened, edited, ready_for_review]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  check_target:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest
    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Runs a single command using the runners shell
      - name: Fail when targeting v2
        run: |
          target=${{ github.base_ref }}
          echo "Target is: $target"
          if [[ $target != "main" ]]; then
            echo "PRs must target main"
            exit 1
          else
            exit 0
          fi
