Skip to content

Commit

Permalink
trying to run phpcs only on changed files
Browse files Browse the repository at this point in the history
  • Loading branch information
faisal-alvi committed Jun 21, 2024
1 parent 708e8c0 commit f0a8817
Show file tree
Hide file tree
Showing 3 changed files with 447 additions and 333 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/php-standards-scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,22 @@ jobs:
coverage: none
tools: composer:v2

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
with:
files: |
**/*.php
- name: Install dependencies
run: composer install

- name: Check WordPress Coding Standards
run: ./vendor/bin/phpcs --standard=.phpcs.xml
if: ${{ steps.changed-files.outputs.any_changed == 'true' }}
run: |
HEAD_REF=$(git rev-parse HEAD)
git checkout $HEAD_REF
run: ./vendor/bin/phpcs-changed --standard=.phpcs.xml -s --git --git-base origin/${{ github.base_ref }} ${{ steps.changed-files.outputs.all_changed_files }}

- name: Check PHP Compatibility
run: ./vendor/bin/phpcs --standard=.phpcompat.xml
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"phpunit/phpunit": "*@stable",
"brianium/paratest": "6.x-dev",
"10up/wp_mock": "dev-trunk",
"10up/phpcs-composer": "dev-master"
"10up/phpcs-composer": "dev-master",
"sirbrillig/phpcs-changed": "^2.11.1"
},
"config": {
"allow-plugins": {
Expand Down
Loading

0 comments on commit f0a8817

Please sign in to comment.