diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 34e4eadb2..d81320d04 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,11 @@ env: jobs: check-style: + # Do not run this job for pull requests where both branches are from the same repo. + # Jobs that depend on this one will be skipped too. + # This prevents duplicate CI runs for our own pull requests, whilst preserving the ability to + # run the CI for each branch push to a fork, and for each pull request originating from a fork. + if: github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id runs-on: windows-latest steps: - name: Checkout @@ -54,6 +59,11 @@ jobs: # Setup the OS matrix so that CUDA tests do not run on forks, as it needs self-hosted runners setup-os-matrix: + # Do not run this job for pull requests where both branches are from the same repo. + # Jobs that depend on this one will be skipped too. + # This prevents duplicate CI runs for our own pull requests, whilst preserving the ability to + # run the CI for each branch push to a fork, and for each pull request originating from a fork. + if: github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id runs-on: ubuntu-latest steps: - name: Setup OS matrix @@ -67,7 +77,6 @@ jobs: os: ${{ steps.setup-os-matrix.outputs.os }} build-and-test: - if: github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id needs: setup-os-matrix strategy: matrix: