Commit 677981e5603 for woocommerce
commit 677981e5603753224ce6c40a5e39c3b0e14c37ea
Author: Seghir Nadir <nadir.seghir@gmail.com>
Date: Fri Oct 16 14:07:41 2026 +0200
Require PHPStan to pass before merging (#69861)
Require PHPStan in the CI merge check
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b51208b8a9b..22f8756ed25 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,6 +14,7 @@ on:
- '!CODEOWNERS'
- '!.github/**'
- '.github/workflows/ci.yml'
+ - '.github/workflows/phpstan.yml'
branches:
- 'trunk'
- 'release/*'
@@ -74,6 +75,7 @@ jobs:
timeout-minutes: 5
outputs:
needs-code-validation: ${{ steps.target-changes.outputs.needs-code-validation }}
+ needs-phpstan-validation: ${{ steps.target-changes.outputs.needs-phpstan-validation }}
needs-changelog-validation: ${{ steps.target-changes.outputs.needs-changelog-validation }}
needs-markdown-validation: ${{ steps.target-changes.outputs.needs-markdown-validation }}
needs-syncpack-validation: ${{ steps.target-changes.outputs.needs-syncpack-validation }}
@@ -87,6 +89,14 @@ jobs:
filters: |
needs-code-validation:
- "!((${{ join( fromJSON( env.NON_CODE_PATHS ), ')|(' ) }}))"
+ needs-phpstan-validation:
+ - 'plugins/woocommerce/**/*.php'
+ - 'plugins/woocommerce/composer.json'
+ - 'plugins/woocommerce/composer.lock'
+ - 'plugins/woocommerce/phpstan.neon'
+ - 'plugins/woocommerce/phpstan-baseline.neon'
+ - '.github/workflows/ci.yml'
+ - '.github/workflows/phpstan.yml'
needs-changelog-validation:
- '{packages,plugins}/*/!((changelog/*)|(readme.txt))'
needs-markdown-validation:
@@ -99,6 +109,13 @@ jobs:
needs-syncpack-validation:
- '(.syncpackrc)|(pnpm-lock.yaml)|(pnpm-workspace.yaml)|(.nvmrc)'
+ phpstan:
+ needs: 'identify-jobs-to-run'
+ if: ${{ !cancelled() && ( github.event_name != 'pull_request' || needs.identify-jobs-to-run.outputs.needs-phpstan-validation == 'true' ) }}
+ uses: ./.github/workflows/phpstan.yml
+ with:
+ refName: ${{ inputs.refName }}
+
project-jobs:
# Since this is a monorepo, not every pull request or change is going to impact every project.
# Instead of running CI tasks on all projects indiscriminately, we use a command to detect
@@ -506,7 +523,7 @@ jobs:
name: 'Evaluate Project Job Statuses'
runs-on: ${{ github.event.pull_request.user.login == 'woocommercebot' && fromJSON('{"group":"WooCommerce Release Checks"}') || 'ubuntu-latest' }}
timeout-minutes: 5
- needs: [ 'project-jobs', 'woocommerce-plugin-build-artifact', 'project-lint-jobs', 'project-test-jobs', 'validate-changelog', 'validate-markdown', 'validate-syncpack' ]
+ needs: [ 'project-jobs', 'woocommerce-plugin-build-artifact', 'project-lint-jobs', 'project-test-jobs', 'validate-changelog', 'validate-markdown', 'validate-syncpack', 'phpstan' ]
# This job must run for all trigger types (not just PRs) so that alert-on-failure can access its outputs
if: ${{ !cancelled() }}
outputs:
diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml
index a999efc0aea..d29fa9538c8 100644
--- a/.github/workflows/phpstan.yml
+++ b/.github/workflows/phpstan.yml
@@ -1,27 +1,12 @@
name: 'PHPStan Analysis'
on:
- pull_request:
- paths:
- - 'plugins/woocommerce/**/*.php'
- - 'plugins/woocommerce/composer.json'
- - 'plugins/woocommerce/composer.lock'
- - 'plugins/woocommerce/phpstan.neon'
- - 'plugins/woocommerce/phpstan-baseline.neon'
- push:
- paths:
- - 'plugins/woocommerce/**/*.php'
- - 'plugins/woocommerce/composer.json'
- - 'plugins/woocommerce/composer.lock'
- - 'plugins/woocommerce/phpstan.neon'
- - 'plugins/woocommerce/phpstan-baseline.neon'
- branches:
- - 'trunk'
- - 'release/*'
-
-concurrency:
- group: phpstan-${{ github.event_name == 'push' && github.run_id || github.event_name }}-${{ github.ref }}
- cancel-in-progress: true
+ workflow_call:
+ inputs:
+ refName:
+ description: 'The ref to analyze. Defaults to the caller workflow ref.'
+ required: false
+ type: string
env:
FORCE_COLOR: 1
@@ -34,6 +19,8 @@ jobs:
steps:
- uses: 'actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0' # v7.0.0
name: 'Checkout'
+ with:
+ ref: ${{ inputs.refName }}
- uses: './.github/actions/setup-woocommerce-monorepo'
id: 'setup-monorepo'