From d4c1d178603c7311ecca012eba85aa57020164ef Mon Sep 17 00:00:00 2001 From: Florian Pesth Date: Tue, 14 Nov 2023 20:46:24 +0100 Subject: [PATCH 1/7] Create action to check against PSR12 coding standard --- .github/workflows/phpcs_psr12.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/phpcs_psr12.yml diff --git a/.github/workflows/phpcs_psr12.yml b/.github/workflows/phpcs_psr12.yml new file mode 100644 index 0000000..c86da7b --- /dev/null +++ b/.github/workflows/phpcs_psr12.yml @@ -0,0 +1,27 @@ +name: "CI" + +on: + pull_request: + paths: + - "html" + +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@v1 + with: + files: "**.php" # you may customize glob as needed + phpcs_path: php phpcs.phar + standard: PSR12 From 60bc0593de2978193c8796600c3bf930b15d65a6 Mon Sep 17 00:00:00 2001 From: Florian Pesth Date: Tue, 14 Nov 2023 20:49:40 +0100 Subject: [PATCH 2/7] Enable manual run of action (?) --- .github/workflows/phpcs_psr12.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/phpcs_psr12.yml b/.github/workflows/phpcs_psr12.yml index c86da7b..f21341f 100644 --- a/.github/workflows/phpcs_psr12.yml +++ b/.github/workflows/phpcs_psr12.yml @@ -1,6 +1,9 @@ name: "CI" on: + workflow_dispatch: + paths: + - "html" pull_request: paths: - "html" From 604846b63ca28cd73a67998308ac8777003e8303 Mon Sep 17 00:00:00 2001 From: Florian Pesth Date: Tue, 14 Nov 2023 20:54:55 +0100 Subject: [PATCH 3/7] Try to fix action --- .github/workflows/phpcs_psr12.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpcs_psr12.yml b/.github/workflows/phpcs_psr12.yml index f21341f..f91a559 100644 --- a/.github/workflows/phpcs_psr12.yml +++ b/.github/workflows/phpcs_psr12.yml @@ -3,10 +3,10 @@ name: "CI" on: workflow_dispatch: paths: - - "html" + - "html/**.php" pull_request: paths: - - "html" + - "html/**.php" jobs: phpcs: From f882fe196a51c746f67315e7e1022182fc32bfbc Mon Sep 17 00:00:00 2001 From: Florian Pesth Date: Tue, 14 Nov 2023 21:50:48 +0100 Subject: [PATCH 4/7] Update phpcs_psr12.yml --- .github/workflows/phpcs_psr12.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/phpcs_psr12.yml b/.github/workflows/phpcs_psr12.yml index f91a559..f6f2948 100644 --- a/.github/workflows/phpcs_psr12.yml +++ b/.github/workflows/phpcs_psr12.yml @@ -3,10 +3,12 @@ name: "CI" on: workflow_dispatch: paths: - - "html/**.php" + - "**.php" + - "html" pull_request: paths: - - "html/**.php" + - "**.php" + - "html" jobs: phpcs: From aeed2a779e0e6b29062bb3ff01e9ed9b95698c92 Mon Sep 17 00:00:00 2001 From: Florian Pesth Date: Wed, 15 Nov 2023 11:41:55 +0100 Subject: [PATCH 5/7] Update phpcs_psr12.yml --- .github/workflows/phpcs_psr12.yml | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/phpcs_psr12.yml b/.github/workflows/phpcs_psr12.yml index f6f2948..cf2870e 100644 --- a/.github/workflows/phpcs_psr12.yml +++ b/.github/workflows/phpcs_psr12.yml @@ -1,14 +1,6 @@ name: "CI" -on: - workflow_dispatch: - paths: - - "**.php" - - "html" - pull_request: - paths: - - "**.php" - - "html" +on: [workflow_dispatch, pull_request] jobs: phpcs: @@ -27,6 +19,6 @@ jobs: - uses: tinovyatkin/action-php-codesniffer@v1 with: - files: "**.php" # you may customize glob as needed + files: "html/*.php" phpcs_path: php phpcs.phar standard: PSR12 From 2589b87305c83057b495a4cd357002e25099ef49 Mon Sep 17 00:00:00 2001 From: Florian Pesth Date: Wed, 15 Nov 2023 11:51:44 +0100 Subject: [PATCH 6/7] Update phpcs_psr12.yml --- .github/workflows/phpcs_psr12.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/phpcs_psr12.yml b/.github/workflows/phpcs_psr12.yml index cf2870e..f087a3e 100644 --- a/.github/workflows/phpcs_psr12.yml +++ b/.github/workflows/phpcs_psr12.yml @@ -19,6 +19,4 @@ jobs: - uses: tinovyatkin/action-php-codesniffer@v1 with: - files: "html/*.php" - phpcs_path: php phpcs.phar standard: PSR12 From 7e55c4705535573a377f293e05eaf3921141b313 Mon Sep 17 00:00:00 2001 From: Florian Pesth Date: Wed, 15 Nov 2023 12:07:25 +0100 Subject: [PATCH 7/7] Update phpcs_psr12.yml --- .github/workflows/phpcs_psr12.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/phpcs_psr12.yml b/.github/workflows/phpcs_psr12.yml index f087a3e..6ecfb15 100644 --- a/.github/workflows/phpcs_psr12.yml +++ b/.github/workflows/phpcs_psr12.yml @@ -17,6 +17,5 @@ jobs: curl -OL https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar php phpcs.phar --version - - uses: tinovyatkin/action-php-codesniffer@v1 - with: - standard: PSR12 + - name: Run phpcs + run: php phpcs.phar --standard=PSR12 html