fix: gate phpcs job on reviewdog result, not phpcs whole-file exit code#24
Merged
Conversation
The reviewdog step ended with `exit $PHPCS_EXIT_CODE`, so the job pass/fail was driven by phpcs's exit code. But phpcs scans the entire changed file, so its exit code reflects every issue in that file - including pre-existing ones on lines the PR never touched. reviewdog, meanwhile, runs with -filter-mode=added and only reports/fails on issues introduced on the PR's added lines. Result: a PR that introduces no new violations but touches a file with pre-existing issues gets no inline comment (reviewdog filtered them out) yet still fails the job with the stale phpcs exit code (e.g. exit 2). This is the false positive seen in the-events-calendar#5687 "clean" test. Switch phpcs to --report=checkstyle piped to reviewdog and exit with reviewdog's code instead. A guard still fails the job when phpcs produces no report at all (i.e. it genuinely failed to run). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
WayneRocha
added a commit
to the-events-calendar/the-events-calendar
that referenced
this pull request
Jul 2, 2026
Tests stellarwp/github-actions#24 against the #5687 scenarios.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
redscar
approved these changes
Jul 2, 2026
dpanta94
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After #22 and #23, the phpcs job still fails on PRs that introduce no new violations.
The
Run reviewdogstep ends with:So the job's pass/fail is driven by phpcs's exit code. But phpcs scans the whole changed file, so its exit code reflects every issue in that file — including pre-existing ones on lines the PR never touched.
reviewdog, by contrast, runs with-filter-mode=addedand only reports/fails on issues introduced on the PR's added lines.The two disagree, and the job exits on the phpcs code.
Reproduction — the-events-calendar#5687 "clean" test (
bf090fc)From the job log:
provider.php, found pre-existing issues → exited 2.exit $PHPCS_EXIT_CODEranexit 2→ job failed anyway.#22/#23focused on faithfully preserving the phpcs exit code — which is exactly the value that should not gate the job.Fix
--report=checkstyleand pipe straight to reviewdog (-f=checkstyle), dropping thejqtransform.-filter-mode=added -fail-level=anymeans reviewdog exits1only when it reports a violation on a line this PR changed.Expected behavior across the-events-calendar#5687 test commits
Test PR
the-events-calendar#5687 repointed to
@fix/phpcs-reviewdog-exit-codeto re-run all three scenarios.Created by claude 🤖