-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update coding standards action (#146)
* Update coding standards action * fix: format
- Loading branch information
Showing
1 changed file
with
33 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,37 @@ | ||
name: WordPress Coding Standards | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
push: | ||
branches: | ||
- master | ||
paths: | ||
- '**.php' | ||
- 'phpcs.xml' | ||
- '.github/workflows/coding-standards.yml' | ||
pull_request: | ||
branches: | ||
- master | ||
paths: | ||
- '**.php' | ||
- 'phpcs.xml' | ||
- '.github/workflows/coding-standards.yml' | ||
jobs: | ||
phpcs: | ||
name: PHPCS | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Install dependencies | ||
run: composer install --prefer-dist --no-progress | ||
- name: Cache dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ runner.os }}-composer | ||
- name: PHPCS check | ||
uses: chekalsky/phpcs-action@v1 | ||
with: | ||
phpcs_bin_path: './vendor/bin/phpcs' | ||
phpcs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 # important! | ||
|
||
# we may use whatever way to install phpcs, just specify the path on the next step | ||
# however, curl seems to be the fastest | ||
- name: Install PHP_CodeSniffer | ||
run: | | ||
curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar | ||
php phpcs.phar --version | ||
- uses: thenabeel/action-phpcs@v8 | ||
with: | ||
files: '**.php' # you may customize glob as needed | ||
phpcs_path: php phpcs.phar | ||
standard: phpcs.xml |