This action was forked from the tinovyatkin/action-php-codesniffer
This action runs PHP_CodeSniffer on files changed in a Pull Request, by default annotating only lines changed by the PR author. So, it's fast and great to work with legacy code:
Contrary to some existing solutions this actions works faster than Docker based actions (as it runs from Node.JS directly in the same VM) and runs only on changed files (good for big projects with some non-conform files as well as to gradually introduce code style).
Add a file like this to .github/workflows/phpcs.yml:
name: "CI"on:
pull_request:
paths:
- "**.php"
- "phpcs.xml"
- ".github/workflows/phpcs.yml"jobs:
phpcs:
runs-on: ubuntu-lateststeps:
- uses: actions/checkout@v2with:
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_CodeSnifferrun: | curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar php phpcs.phar --version - uses: thenabeel/action-phpcs@v8with:
files: "**.php"# you may customize glob as neededphpcs_path: php phpcs.pharstandard: phpcs.xmlYou also will need either to pick a build code style standard or create phpcs.xml file (like this for example).
You may find all available configuration options at action.yml in this repository.
