diff --git a/.github/workflows/audit.yaml b/.github/workflows/audit.yaml index 6750315ed38..8e01a7cf0d2 100644 --- a/.github/workflows/audit.yaml +++ b/.github/workflows/audit.yaml @@ -5,6 +5,7 @@ jobs: audit: + if: ${{ github.repository_owner == 'pantsbuild' }} runs-on: ubuntu-latest steps: - name: Check out code diff --git a/.github/workflows/cancel.yaml b/.github/workflows/cancel.yaml index 9cfce8b14cf..32f2965d253 100644 --- a/.github/workflows/cancel.yaml +++ b/.github/workflows/cancel.yaml @@ -5,6 +5,7 @@ jobs: cancel: + if: ${{ github.repository_owner == 'pantsbuild' }} runs-on: ubuntu-latest steps: - uses: styfle/cancel-workflow-action@0.8.0 diff --git a/.github/workflows/test-cron.yaml b/.github/workflows/test-cron.yaml index 3f3a2215392..29670376fa9 100644 --- a/.github/workflows/test-cron.yaml +++ b/.github/workflows/test-cron.yaml @@ -11,6 +11,7 @@ jobs: env: PANTS_REMOTE_CACHE_READ: 'false' PANTS_REMOTE_CACHE_WRITE: 'false' + if: ${{ github.repository_owner == 'pantsbuild' }} name: Bootstrap Pants, test+lint Rust (Linux) runs-on: ubuntu-20.04 steps: @@ -155,6 +156,7 @@ jobs: env: PANTS_REMOTE_CACHE_READ: 'false' PANTS_REMOTE_CACHE_WRITE: 'false' + if: ${{ github.repository_owner == 'pantsbuild' }} name: Bootstrap Pants, test Rust (macOS) runs-on: macos-10.15 steps: @@ -274,6 +276,7 @@ jobs: - '3.9' timeout-minutes: 40 lint_python: + if: ${{ github.repository_owner == 'pantsbuild' }} name: Lint Python and Shell needs: bootstrap_pants_linux runs-on: ubuntu-20.04 @@ -350,6 +353,7 @@ jobs: - '3.9' timeout-minutes: 30 test_python_linux: + if: ${{ github.repository_owner == 'pantsbuild' }} name: Test Python (Linux) needs: bootstrap_pants_linux runs-on: ubuntu-20.04 @@ -428,6 +432,7 @@ jobs: test_python_macos: env: ARCHFLAGS: -arch x86_64 + if: ${{ github.repository_owner == 'pantsbuild' }} name: Test Python (macOS) needs: bootstrap_pants_macos runs-on: macos-10.15 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c77b350df3e..823fee96c71 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -11,6 +11,7 @@ jobs: env: PANTS_REMOTE_CACHE_READ: 'false' PANTS_REMOTE_CACHE_WRITE: 'false' + if: ${{ github.repository_owner == 'pantsbuild' }} name: Bootstrap Pants, test+lint Rust (Linux) runs-on: ubuntu-20.04 steps: @@ -154,6 +155,7 @@ jobs: env: PANTS_REMOTE_CACHE_READ: 'false' PANTS_REMOTE_CACHE_WRITE: 'false' + if: ${{ github.repository_owner == 'pantsbuild' }} name: Bootstrap Pants, test Rust (macOS) runs-on: macos-10.15 steps: @@ -276,6 +278,7 @@ jobs: env: PANTS_REMOTE_CACHE_READ: 'false' PANTS_REMOTE_CACHE_WRITE: 'false' + if: ${{ github.repository_owner == 'pantsbuild' }} name: Build wheels and fs_util (Linux) runs-on: ubuntu-20.04 steps: @@ -348,6 +351,7 @@ jobs: env: PANTS_REMOTE_CACHE_READ: 'false' PANTS_REMOTE_CACHE_WRITE: 'false' + if: ${{ github.repository_owner == 'pantsbuild' }} name: Build wheels and fs_util (macOS) runs-on: macos-10.15 steps: @@ -436,6 +440,7 @@ jobs: run: ./build-support/bin/deploy_to_s3.py timeout-minutes: 65 lint_python: + if: ${{ github.repository_owner == 'pantsbuild' }} name: Lint Python and Shell needs: bootstrap_pants_linux runs-on: ubuntu-20.04 @@ -511,6 +516,7 @@ jobs: - '3.7' timeout-minutes: 30 test_python_linux: + if: ${{ github.repository_owner == 'pantsbuild' }} name: Test Python (Linux) needs: bootstrap_pants_linux runs-on: ubuntu-20.04 @@ -588,6 +594,7 @@ jobs: test_python_macos: env: ARCHFLAGS: -arch x86_64 + if: ${{ github.repository_owner == 'pantsbuild' }} name: Test Python (macOS) needs: bootstrap_pants_macos runs-on: macos-10.15 diff --git a/build-support/bin/generate_github_workflows.py b/build-support/bin/generate_github_workflows.py index c8b92b01d02..a5aaf962d11 100644 --- a/build-support/bin/generate_github_workflows.py +++ b/build-support/bin/generate_github_workflows.py @@ -60,6 +60,8 @@ MACOS_ENV = {"ARCHFLAGS": "-arch x86_64"} +IS_PANTS_OWNER = "${{ github.repository_owner == 'pantsbuild' }}" + # ---------------------------------------------------------------------- # Actions # ---------------------------------------------------------------------- @@ -261,6 +263,7 @@ def test_workflow_jobs(python_versions: list[str], *, cron: bool) -> Jobs: "strategy": {"matrix": {"python-version": python_versions}}, "env": DISABLE_REMOTE_CACHE_ENV, "timeout-minutes": 40, + "if": IS_PANTS_OWNER, "steps": [ *checkout(), setup_toolchain_auth(), @@ -302,6 +305,7 @@ def test_workflow_jobs(python_versions: list[str], *, cron: bool) -> Jobs: "needs": "bootstrap_pants_linux", "strategy": {"matrix": {"python-version": python_versions}}, "timeout-minutes": 60, + "if": IS_PANTS_OWNER, "steps": [ *checkout(), setup_toolchain_auth(), @@ -319,6 +323,7 @@ def test_workflow_jobs(python_versions: list[str], *, cron: bool) -> Jobs: "needs": "bootstrap_pants_linux", "strategy": {"matrix": {"python-version": python_versions}}, "timeout-minutes": 30, + "if": IS_PANTS_OWNER, "steps": [ *checkout(), setup_toolchain_auth(), @@ -338,6 +343,7 @@ def test_workflow_jobs(python_versions: list[str], *, cron: bool) -> Jobs: "strategy": {"matrix": {"python-version": python_versions}}, "env": DISABLE_REMOTE_CACHE_ENV, "timeout-minutes": 40, + "if": IS_PANTS_OWNER, "steps": [ *checkout(), setup_toolchain_auth(), @@ -363,6 +369,7 @@ def test_workflow_jobs(python_versions: list[str], *, cron: bool) -> Jobs: "strategy": {"matrix": {"python-version": python_versions}}, "env": MACOS_ENV, "timeout-minutes": 40, + "if": IS_PANTS_OWNER, "steps": [ *checkout(), setup_toolchain_auth(), @@ -418,6 +425,7 @@ def build_wheels_step(*, is_macos: bool) -> Step: "container": "quay.io/pypa/manylinux2014_x86_64:latest", "timeout-minutes": 65, "env": DISABLE_REMOTE_CACHE_ENV, + "if": IS_PANTS_OWNER, "steps": [ *checkout(), install_rustup(), @@ -441,6 +449,7 @@ def build_wheels_step(*, is_macos: bool) -> Step: "runs-on": MACOS_VERSION, "timeout-minutes": 65, "env": DISABLE_REMOTE_CACHE_ENV, + "if": IS_PANTS_OWNER, "steps": [ *checkout(), setup_toolchain_auth(), @@ -522,6 +531,7 @@ def generate() -> dict[Path, str]: "jobs": { "cancel": { "runs-on": "ubuntu-latest", + "if": IS_PANTS_OWNER, "steps": [ { "uses": "styfle/cancel-workflow-action@0.8.0", @@ -544,6 +554,7 @@ def generate() -> dict[Path, str]: "jobs": { "audit": { "runs-on": "ubuntu-latest", + "if": IS_PANTS_OWNER, "steps": [ *checkout(), {