From ecd1a396d4894c71d38b3c2789545e7ae3fd6041 Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Mon, 15 Jun 2026 00:08:31 +0900 Subject: [PATCH] ci: skip push-triggered checks on forks When a fork syncs with the upstream WordPress/ai repository, the push to develop/trunk re-runs the Test and Plugin Check workflows on the fork, wasting CI minutes for no benefit. Gate those jobs so they run only on the upstream repository or for pull requests, keeping PR CI intact on forks. Co-Authored-By: Claude --- .github/workflows/plugin-check.yml | 1 + .github/workflows/test.yml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/plugin-check.yml b/.github/workflows/plugin-check.yml index 531b3d90a..bea1ff92a 100644 --- a/.github/workflows/plugin-check.yml +++ b/.github/workflows/plugin-check.yml @@ -26,6 +26,7 @@ jobs: plugin-check: name: Run Plugin Check runs-on: 'ubuntu-24.04' + if: ${{ github.repository == 'WordPress/ai' || github.event_name == 'pull_request' }} permissions: contents: read timeout-minutes: 20 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c7a573813..9b2a10851 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,6 +33,7 @@ jobs: phpcs: name: Run PHPCS coding standards checks runs-on: ubuntu-24.04 + if: ${{ github.repository == 'WordPress/ai' || github.event_name == 'pull_request' }} permissions: contents: read timeout-minutes: 20 @@ -89,6 +90,7 @@ jobs: phpstan: name: Run PHP static analysis runs-on: ubuntu-24.04 + if: ${{ github.repository == 'WordPress/ai' || github.event_name == 'pull_request' }} permissions: contents: read timeout-minutes: 20 @@ -167,6 +169,7 @@ jobs: phpunit: name: Test PHP ${{ matrix.php }} WP ${{ matrix.wp }}${{ matrix.coverage && ' with coverage' || '' }} runs-on: ubuntu-24.04 + if: ${{ github.repository == 'WordPress/ai' || github.event_name == 'pull_request' }} strategy: fail-fast: false matrix: @@ -272,6 +275,7 @@ jobs: jslint: name: Run JavaScript code quality checks runs-on: ubuntu-24.04 + if: ${{ github.repository == 'WordPress/ai' || github.event_name == 'pull_request' }} permissions: contents: read timeout-minutes: 20