Skip to content

Run PHP coding standards when dependencies change - #644

Merged
triple0t merged 1 commit into
trunkfrom
update/phpcs-workflow-trigger-paths
Jul 28, 2026
Merged

Run PHP coding standards when dependencies change#644
triple0t merged 1 commit into
trunkfrom
update/phpcs-workflow-trigger-paths

Conversation

@triple0t

@triple0t triple0t commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Changes proposed in this Pull Request:

The PHP coding standards job only runs when a **.php file changes. That leaves a gap: a pull request that changes the project's dependencies is never linted, even though dependencies are what supply the coding standards themselves.

This is not hypothetical. The recent WPCS 3.4.1 update (GHSA-3pwp-g2mj-5p3v) touched composer.lock only. It replaced the entire coding-standards ruleset and no lint job ran on it.

This adds composer.json and composer.lock to the filter.

This repo gates differently from its siblings: pull_request has no paths filter, and the phpcs job is instead gated on a dorny/paths-filter step carrying the same **.php list. The effect was identical — a composer.lock-only PR skipped the job — so both the push paths block and the filters block are updated.

Detailed test instructions:

This changes when the workflow fires, not what it does, so the check is behavioural:

  1. Confirm the workflow still parses — GitHub rejects invalid YAML, so a green Actions tab here is the first signal.
  2. On this PR the job should run: it edits .github/workflows/php-coding-standards.yml, which was already in the filter.
  3. To prove the new behaviour, push a commit here changing only composer.lock (a whitespace edit is enough) and confirm the job still triggers. Before this change it would not have.
  4. Confirm nothing else changed: the diff should be four added lines, two per trigger.

Additional details:

No change to what phpcs does or which rules apply — only to when the job is triggered. The cost is that dependency-only pull requests now run one extra short job.

An earlier version of this PR also added phpcs.xml.dist to the filter. That is pulled out and left for a separate discussion: changing the lint config can surface pre-existing violations across the whole tree, and that deserves its own decision rather than riding along here.

Changelog entry

Dev - Run the PHP coding standards job when dependencies change.

@github-actions github-actions Bot added the changelog: update Big changes to something that wasn't broken. label Jul 28, 2026
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • .github/workflows/php-coding-standards.yml is excluded by none and included by none

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 03cb38e6-d9d8-40fa-b13f-c9495f02ddae

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update/phpcs-workflow-trigger-paths

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The phpcs job only ran when a **.php file changed, so a pull request
that changed the project's dependencies went unchecked.

The WPCS 3.4.1 update was exactly that: it changed composer.lock only,
swapped the whole coding-standards ruleset underneath, and no lint ran
on it.

Adds composer.json and composer.lock to the filter.

This repo gates differently from its siblings: `pull_request` has no `paths` filter, and the `phpcs` job is instead gated on a `dorny/paths-filter` step carrying the same `**.php` list. The effect was identical — a `composer.lock`-only PR skipped the job — so both the `push` `paths` block and the `filters` block are updated.
@triple0t
triple0t force-pushed the update/phpcs-workflow-trigger-paths branch from 0a53f24 to deeb77a Compare July 28, 2026 12:19
@triple0t triple0t changed the title Run PHP coding standards when the lint config or dependencies change Run PHP coding standards when dependencies change Jul 28, 2026
@triple0t
triple0t merged commit 85d04de into trunk Jul 28, 2026
4 checks passed
@triple0t
triple0t deleted the update/phpcs-workflow-trigger-paths branch July 28, 2026 13:08
@costasovo costasovo mentioned this pull request Aug 6, 2026
21 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: update Big changes to something that wasn't broken.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant