diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml new file mode 100644 index 00000000000..560891f1ef1 --- /dev/null +++ b/.github/workflows/phpcs.yml @@ -0,0 +1,30 @@ +name: "PHPCS" + +on: + pull_request: + paths: + - "**.php" + - "phpcs.xml" + - ".github/workflows/phpcs.yml" + +jobs: + phpcs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 50 # 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: dev/setup/codesniffer/ruleset.xml + fail_on_warnings: false