From 329c5761636a0ad3e6f88793552122db2f3844fe Mon Sep 17 00:00:00 2001 From: Advait Jain Date: Sat, 25 May 2024 10:03:15 -0700 Subject: [PATCH] Do not run nightly workflows on forks. (#15) This change can't really be tested until: * it is merged: to make sure nothing breaks for the upstream repo * forks update to upstream/main: to confirm that workflows are not triggered in forks. BUG=cleanup github workflows. --- .github/workflows/mark_stale.yml | 3 +++ .github/workflows/nightly_generative_api.yml | 4 ++++ .github/workflows/nightly_model_coverage.yml | 4 ++++ .github/workflows/nightly_pip_test.yml | 4 ++++ .github/workflows/nightly_unittests.yml | 4 ++++ 5 files changed, 19 insertions(+) diff --git a/.github/workflows/mark_stale.yml b/.github/workflows/mark_stale.yml index f8707652..7802cf22 100644 --- a/.github/workflows/mark_stale.yml +++ b/.github/workflows/mark_stale.yml @@ -12,6 +12,9 @@ on: jobs: stale: + if: | + github.event_name == 'workflow_dispatch' || + (github.event_name == 'schedule' && github.repository == 'google-ai-edge/ai-edge-torch') # don't run in forks. runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/nightly_generative_api.yml b/.github/workflows/nightly_generative_api.yml index b74380b4..bbab3835 100644 --- a/.github/workflows/nightly_generative_api.yml +++ b/.github/workflows/nightly_generative_api.yml @@ -12,6 +12,10 @@ on: jobs: run-generative-api-examples: + if: | + github.event_name == 'workflow_dispatch' || + (github.event_name == 'schedule' && github.repository == 'google-ai-edge/ai-edge-torch') # don't run in forks. + name: Generative API Examples uses: ./.github/workflows/generative_api_examples.yml with: diff --git a/.github/workflows/nightly_model_coverage.yml b/.github/workflows/nightly_model_coverage.yml index 03766767..f1bfe4a0 100644 --- a/.github/workflows/nightly_model_coverage.yml +++ b/.github/workflows/nightly_model_coverage.yml @@ -12,6 +12,10 @@ on: jobs: run-model-coverage: + if: | + github.event_name == 'workflow_dispatch' || + (github.event_name == 'schedule' && github.repository == 'google-ai-edge/ai-edge-torch') # don't run in forks. + name: Model Coverage (nightly) uses: ./.github/workflows/model_coverage.yml secrets: inherit diff --git a/.github/workflows/nightly_pip_test.yml b/.github/workflows/nightly_pip_test.yml index 5d88ec1d..a8cbc638 100644 --- a/.github/workflows/nightly_pip_test.yml +++ b/.github/workflows/nightly_pip_test.yml @@ -16,6 +16,10 @@ jobs: matrix: python-version: ["3.9", "3.10", "3.11"] + if: | + github.event_name == 'workflow_dispatch' || + (github.event_name == 'schedule' && github.repository == 'google-ai-edge/ai-edge-torch') # don't run in forks. + runs-on: ubuntu-latest steps: - uses: actions/setup-python@v4 diff --git a/.github/workflows/nightly_unittests.yml b/.github/workflows/nightly_unittests.yml index ea01f510..020b98a0 100644 --- a/.github/workflows/nightly_unittests.yml +++ b/.github/workflows/nightly_unittests.yml @@ -12,6 +12,10 @@ on: jobs: run-unittests-python: + if: | + github.event_name == 'workflow_dispatch' || + (github.event_name == 'schedule' && github.repository == 'google-ai-edge/ai-edge-torch') # don't run in forks. + name: Unit Tests Python uses: ./.github/workflows/unittests_python.yml with: