Skip to content

fix/295: Exclude 10up-lib from PHPCS linting #494

fix/295: Exclude 10up-lib from PHPCS linting

fix/295: Exclude 10up-lib from PHPCS linting #494

name: PHP Linting
on:
push:
branches:
- develop
- trunk
pull_request:
branches:
- develop
jobs:
php-compatibility:
name: Sniffs and Compatibility
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set PHP version
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer:v2, cs2pr
coverage: none
- name: Install dependencies
run: composer install
- name: Get updated PHP files
id: changed-files
uses: tj-actions/changed-files@v41
with:
files: |
**/*.php
- name: WPCS check
run: |
if [[ "${{ steps.changed-files.outputs.any_changed }}" == 'true' && "${{ github.event_name }}" == "pull_request" ]]; then
./vendor/bin/phpcs ${{ steps.changed-files.outputs.all_changed_files }}
elif [[ "${{ github.event_name }}" == "push" ]]; then
./vendor/bin/phpcs .
fi
- name: PHP Compatibility check
run: |
if [[ "${{ steps.changed-files.outputs.any_changed }}" == 'true' && "${{ github.event_name }}" == "pull_request" ]]; then
./vendor/bin/phpcs ${{ steps.changed-files.outputs.all_changed_files }} --standard=PHPCompatibilityWP --ignore=vendor --extensions=php --runtime-set testVersion 7.4- --report=checkstyle | cs2pr
elif [[ "${{ github.event_name }}" == "push" ]]; then
./vendor/bin/phpcs . --standard=PHPCompatibilityWP --ignore=vendor --extensions=php --runtime-set testVersion 7.4- --report=checkstyle | cs2pr
fi