Commit 9d8ca362449 for woocommerce
commit 9d8ca3624490ea9e3d33cb41f1345c5283a91d54
Author: Raluca Stan <ralucastn@gmail.com>
Date: Mon Jul 27 05:56:50 2026 -0400
Fix PHPStan annotations not appearing on the diff (#66991)
Make PHPStan annotations resolve against the repo root
diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml
index 642f918dd44..80859021ec1 100644
--- a/.github/workflows/phpstan.yml
+++ b/.github/workflows/phpstan.yml
@@ -58,7 +58,18 @@ jobs:
run: |
set +e # Don't exit immediately on error
set -o pipefail # But do capture pipeline exit codes
- pnpm --filter='@woocommerce/plugin-woocommerce' phpstan 2>&1 | tee /tmp/phpstan-output.txt
+ # PHPStan detects GitHub Actions and emits '::error file=,line=,col=::' workflow
+ # commands on its own, but its paths are relative to this working directory while
+ # GitHub resolves annotation paths from the repo root. Without this rewrite the
+ # annotations are emitted and then silently dropped, never showing up on the diff.
+ #
+ # The pattern is anchored so it only ever touches the path of a file-scoped error.
+ # PHPStan's other two output shapes - '::error ::message' for errors that belong to
+ # no file, and '::warning ::message' - carry no path, and a stray 'file=' inside one
+ # of their messages must not be rewritten into a bogus path.
+ pnpm --filter='@woocommerce/plugin-woocommerce' phpstan 2>&1 \
+ | sed -u 's|^::error file=|::error file=plugins/woocommerce/|' \
+ | tee /tmp/phpstan-output.txt
PHPSTAN_EXIT=${PIPESTATUS[0]}
if [[ $PHPSTAN_EXIT -ne 0 ]]; then
if grep -q "was not matched in reported errors" /tmp/phpstan-output.txt; then