Skip to content

Commit

Permalink
Avoid duplicate CI runs for pull requests made from the same repo. (#485
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jgiannuzzi authored May 25, 2021
1 parent 20adbd1 commit dc11cbf
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit dc11cbf

Please sign in to comment.