From 60e39636d067b089b18730d5317a76f7d34b999c Mon Sep 17 00:00:00 2001 From: Anderson Banihirwe Date: Thu, 6 May 2021 10:17:25 -0600 Subject: [PATCH] Disable workflows on forks (#5267) --- .github/workflows/cancel-duplicate-runs.yaml | 1 + .github/workflows/ci-additional.yaml | 5 ++++- .github/workflows/ci-pre-commit.yml | 1 + .github/workflows/ci.yaml | 4 +++- .github/workflows/upstream-dev-ci.yaml | 12 ++++-------- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cancel-duplicate-runs.yaml b/.github/workflows/cancel-duplicate-runs.yaml index 00eac2c3a3f..46637bdc112 100644 --- a/.github/workflows/cancel-duplicate-runs.yaml +++ b/.github/workflows/cancel-duplicate-runs.yaml @@ -8,6 +8,7 @@ jobs: cancel: name: Cancel previous runs runs-on: ubuntu-latest + if: github.repository == 'pydata/xarray' steps: - uses: styfle/cancel-workflow-action@0.9.0 with: diff --git a/.github/workflows/ci-additional.yaml b/.github/workflows/ci-additional.yaml index 828e37817b1..47f4ba88143 100644 --- a/.github/workflows/ci-additional.yaml +++ b/.github/workflows/ci-additional.yaml @@ -12,7 +12,9 @@ jobs: detect-ci-trigger: name: detect ci trigger runs-on: ubuntu-latest - if: github.event_name == 'push' || github.event_name == 'pull_request' + if: | + github.repository == 'pydata/xarray' + && (github.event_name == 'push' || github.event_name == 'pull_request') outputs: triggered: ${{ steps.detect-trigger.outputs.trigger-found }} steps: @@ -111,6 +113,7 @@ jobs: doctest: name: Doctests runs-on: "ubuntu-latest" + if: github.repository == 'pydata/xarray' defaults: run: shell: bash -l {0} diff --git a/.github/workflows/ci-pre-commit.yml b/.github/workflows/ci-pre-commit.yml index 92a3c07dd6b..4bc5bddfdbc 100644 --- a/.github/workflows/ci-pre-commit.yml +++ b/.github/workflows/ci-pre-commit.yml @@ -10,6 +10,7 @@ jobs: linting: name: "pre-commit hooks" runs-on: ubuntu-latest + if: github.repository == 'pydata/xarray' steps: - uses: actions/checkout@v2 - uses: actions/setup-python@v2 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f45e0b4d2e1..8afd1a93366 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,7 +12,9 @@ jobs: detect-ci-trigger: name: detect ci trigger runs-on: ubuntu-latest - if: github.event_name == 'push' || github.event_name == 'pull_request' + if: | + github.repository == 'pydata/xarray' + && (github.event_name == 'push' || github.event_name == 'pull_request') outputs: triggered: ${{ steps.detect-trigger.outputs.trigger-found }} steps: diff --git a/.github/workflows/upstream-dev-ci.yaml b/.github/workflows/upstream-dev-ci.yaml index afa053b43fc..a903a14acbc 100644 --- a/.github/workflows/upstream-dev-ci.yaml +++ b/.github/workflows/upstream-dev-ci.yaml @@ -14,7 +14,9 @@ jobs: detect-ci-trigger: name: detect upstream-dev ci trigger runs-on: ubuntu-latest - if: github.event_name == 'push' || github.event_name == 'pull_request' + if: | + github.repository == 'pydata/xarray' + && (github.event_name == 'push' || github.event_name == 'pull_request') outputs: triggered: ${{ steps.detect-trigger.outputs.trigger-found }} steps: @@ -31,12 +33,8 @@ jobs: runs-on: ubuntu-latest needs: detect-ci-trigger if: | - always() - && github.repository == 'pydata/xarray' - && ( (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') || needs.detect-ci-trigger.outputs.triggered == 'true' - ) defaults: run: shell: bash -l {0} @@ -97,9 +95,7 @@ jobs: name: report needs: upstream-dev if: | - always() - && github.event_name == 'schedule' - && github.repository == 'pydata/xarray' + github.event_name == 'schedule' && needs.upstream-dev.outputs.artifacts_availability == 'true' runs-on: ubuntu-latest defaults: