From 9495c90bf307ceb4e1ccfa639d7e1171568ccd60 Mon Sep 17 00:00:00 2001 From: Ashley Hitchcock Date: Fri, 6 Jan 2023 20:31:03 +0000 Subject: [PATCH] Update coding standards action (#146) * Update coding standards action * fix: format --- .github/workflows/coding-standards.yml | 60 ++++++++++++++------------ 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index d6c388f..7697611 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -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' \ No newline at end of file + 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