name: nf-core branch protection
# This workflow is triggered on PRs to `master` branch on the repository
# It fails when someone tries to make a PR against the nf-core `master` branch instead of `dev`
on:
  pull_request:
    branches:
    - master

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      # PRs are only ok if coming from an nf-core `dev` branch or a fork `patch` branch
      - name: Check PRs
        run: |
          { [[ $(git remote get-url origin) == *nf-core/sarek ]] && [[ ${GITHUB_HEAD_REF} = "dev" ]]; } || [[ ${GITHUB_HEAD_REF} == "patch" ]]
