From 4f3662c845e8e52fd90771dfed83d23485437c99 Mon Sep 17 00:00:00 2001 From: Konstantin Vyatkin Date: Mon, 4 May 2020 03:11:33 -0400 Subject: [PATCH 1/5] add action --- .github/workflows/phpcs.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/phpcs.yml diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml new file mode 100644 index 0000000000000..7727537d62d4a --- /dev/null +++ b/.github/workflows/phpcs.yml @@ -0,0 +1,28 @@ +name: "CI" +on: # rebuild any PRs and main branch changes + pull_request: + paths: + - "**.php" + - "phpcs.xml" + - ".github/workflows/phpcs.yml" + +jobs: + 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: tinovyatkin/action-php-codesniffer@master + with: + files: "**.php" + phpcs_path: php phpcs.phar + standard: "phpcs.xml" From 877724002d3cb0402e249850d940dff7edef16ad Mon Sep 17 00:00:00 2001 From: Konstantin Vyatkin Date: Mon, 4 May 2020 03:15:00 -0400 Subject: [PATCH 2/5] pretttier --- .github/workflows/phpcs.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 7727537d62d4a..5e79fb06b362f 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -1,5 +1,6 @@ name: "CI" -on: # rebuild any PRs and main branch changes + +on: pull_request: paths: - "**.php" @@ -25,4 +26,4 @@ jobs: with: files: "**.php" phpcs_path: php phpcs.phar - standard: "phpcs.xml" + standard: phpcs.xml From 200f3c3e85d0d0a665f71fe5ac080ae5e9b20453 Mon Sep 17 00:00:00 2001 From: Konstantin Vyatkin Date: Mon, 4 May 2020 03:17:34 -0400 Subject: [PATCH 3/5] let's change some legacy file --- includes/legacy/api/v1/class-wc-api-coupons.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/legacy/api/v1/class-wc-api-coupons.php b/includes/legacy/api/v1/class-wc-api-coupons.php index 244b5efd3b0ed..55722eec03e22 100644 --- a/includes/legacy/api/v1/class-wc-api-coupons.php +++ b/includes/legacy/api/v1/class-wc-api-coupons.php @@ -18,7 +18,7 @@ class WC_API_Coupons extends WC_API_Resource { /** @var string $base the route base */ - protected $base = '/coupons'; + protected $base = '/coupons'; /** * Register the routes for this class From 26bd0df3f5bb2f4a2674c9a1e3873faaa62c7832 Mon Sep 17 00:00:00 2001 From: Konstantin Vyatkin Date: Mon, 4 May 2020 03:21:47 -0400 Subject: [PATCH 4/5] let's change some legacy file 2 --- includes/legacy/api/v2/class-wc-api-coupons.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/legacy/api/v2/class-wc-api-coupons.php b/includes/legacy/api/v2/class-wc-api-coupons.php index ca57fb4670e0a..8234b41e0d9d9 100644 --- a/includes/legacy/api/v2/class-wc-api-coupons.php +++ b/includes/legacy/api/v2/class-wc-api-coupons.php @@ -30,7 +30,7 @@ class WC_API_Coupons extends WC_API_Resource { * @param array $routes * @return array */ - public function register_routes( $routes ) { + public function register_routes( $routes ) { # GET/POST /coupons $routes[ $this->base ] = array( From 2010d9c25b0ff78eba942b15f6f59025ff188c1f Mon Sep 17 00:00:00 2001 From: Konstantin Vyatkin Date: Mon, 4 May 2020 03:46:26 -0400 Subject: [PATCH 5/5] use v1 --- .github/workflows/phpcs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 5e79fb06b362f..9e58732a726bc 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -22,7 +22,7 @@ jobs: curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar php phpcs.phar --version - - uses: tinovyatkin/action-php-codesniffer@master + - uses: tinovyatkin/action-php-codesniffer@v1 with: files: "**.php" phpcs_path: php phpcs.phar