Skip to content

Fix changed files action for phpcs baseline #189

Merged
sprankhub merged 2 commits intomage-os:mainfrom
Tjitse-E:fix/changed-files-for-phpcs-baseline
Nov 16, 2023
Merged

Fix changed files action for phpcs baseline #189
sprankhub merged 2 commits intomage-os:mainfrom
Tjitse-E:fix/changed-files-for-phpcs-baseline

Conversation

@Tjitse-E
Copy link
Contributor

@Tjitse-E Tjitse-E commented Nov 16, 2023

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Currently we use tj-actions/changed-files to extract the files changed in a PR. This caused issues in the integration testing PR: the reported changed files were invalid and not changed by the PR.

I've fixed this by using dorny/paths-filter to extract the files that need checking with PHCPcs. It's a Github action we have been using for almost a year internally at Vendic. Using dorny/paths-filter we can only filter added or modified files that match our glob.

What is the new behavior?

In addition to that I also moved the repo and ref to the action input. This allows for easier testing specific PR's if more bugs occur in the future

Does this PR introduce a breaking change?

  • Yes
  • No

See mage-os/mageos-magento2#59

Other information

See an example that shows the correct behaviour here.
This run:

  • demonstrates that the baseline works, since the scanned file (app/code/Magento/AdminAnalytics/Model/ResourceModel/Viewer/Logger.php) contains an existing phpcs issue 24 | WARNING | Visibility must be declared on all constants if your project supports PHP 7.1 or later.
  • demonstrates that the action extracts the correct files to scan for phpcs

@sprankhub sprankhub merged commit 0575002 into mage-os:main Nov 16, 2023
@Tjitse-E Tjitse-E deleted the fix/changed-files-for-phpcs-baseline branch November 16, 2023 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants