2021-02-09 10:39:56 +00:00
|
|
|
name: Run code sniff on PR
|
|
|
|
on:
|
|
|
|
pull_request
|
2021-10-13 03:38:36 +00:00
|
|
|
defaults:
|
|
|
|
run:
|
|
|
|
shell: bash
|
2022-04-21 16:45:12 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
cancel-in-progress: true
|
2021-02-09 10:39:56 +00:00
|
|
|
jobs:
|
|
|
|
test:
|
|
|
|
name: Code sniff (PHP 7.4, WP Latest)
|
|
|
|
timeout-minutes: 15
|
2022-04-27 01:28:56 +00:00
|
|
|
runs-on: ubuntu-20.04
|
2021-02-09 10:39:56 +00:00
|
|
|
steps:
|
2022-05-17 18:48:24 +00:00
|
|
|
- uses: actions/checkout@v3
|
2021-03-14 00:01:21 +00:00
|
|
|
with:
|
2022-06-27 18:46:29 +00:00
|
|
|
fetch-depth: 0
|
2022-10-25 07:17:38 +00:00
|
|
|
|
|
|
|
- name: Get Changed Files
|
|
|
|
id: changed-files
|
|
|
|
uses: tj-actions/changed-files@v32
|
|
|
|
with:
|
|
|
|
files: |
|
|
|
|
**/*.php
|
2021-02-09 10:39:56 +00:00
|
|
|
|
2022-09-13 01:55:03 +00:00
|
|
|
- name: Setup WooCommerce Monorepo
|
2022-10-25 07:17:38 +00:00
|
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
2022-09-13 01:55:03 +00:00
|
|
|
uses: ./.github/actions/setup-woocommerce-monorepo
|
2021-02-09 10:39:56 +00:00
|
|
|
with:
|
2022-09-13 01:55:03 +00:00
|
|
|
build: false
|
2021-02-09 10:39:56 +00:00
|
|
|
|
|
|
|
- name: Tool versions
|
2022-10-25 07:17:38 +00:00
|
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
2021-02-09 10:39:56 +00:00
|
|
|
run: |
|
|
|
|
php --version
|
|
|
|
composer --version
|
|
|
|
|
2022-10-25 07:17:38 +00:00
|
|
|
- name: Run PHPCS
|
|
|
|
if: steps.changed-files.outputs.any_changed == 'true'
|
|
|
|
run: ./plugins/woocommerce/vendor/bin/phpcs -n -q --report=checkstyle ${{ steps.changed-files.outputs.all_changed_files }} | cs2pr
|