From a91b4277b9f4d4540d6aee420f944424fcf433c7 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Sun, 15 May 2022 12:24:23 +0700 Subject: [PATCH 01/10] generate json report --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 8998eeb..098450c 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -43,9 +43,9 @@ else fi if [ "${HAS_CONFIG}" = true ] && [ "${INPUT_USE_LOCAL_CONFIG}" = "true" ] ; then - ${INPUT_PHPCS_BIN_PATH} ${WARNING_FLAG} --report=checkstyle + ${INPUT_PHPCS_BIN_PATH} ${WARNING_FLAG} --report=checkstyle --report-json=./phpcs.json else - ${INPUT_PHPCS_BIN_PATH} ${WARNING_FLAG} --report=checkstyle --standard=${INPUT_STANDARD} --ignore=${EXCLUDES} --extensions=php ${INPUT_PATHS} + ${INPUT_PHPCS_BIN_PATH} ${WARNING_FLAG} --report=checkstyle --report-json=./phpcs.json --standard=${INPUT_STANDARD} --ignore=${EXCLUDES} --extensions=php ${INPUT_PATHS} fi status=$? From 02070e0a0c0894796e5395ba41432416f5d7fa15 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Sun, 15 May 2022 12:32:09 +0700 Subject: [PATCH 02/10] try generate md and add it to gh action summary --- entrypoint.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 098450c..5dab4a5 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -48,6 +48,9 @@ else ${INPUT_PHPCS_BIN_PATH} ${WARNING_FLAG} --report=checkstyle --report-json=./phpcs.json --standard=${INPUT_STANDARD} --ignore=${EXCLUDES} --extensions=php ${INPUT_PATHS} fi +npx github:10up/phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md +cat phpcs.md >> $GITHUB_STEP_SUMMARY + status=$? echo "::remove-matcher owner=phpcs::" From b6323b0fdfd7aaefbb68da82790f47a934df2120 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Sun, 15 May 2022 12:47:56 +0700 Subject: [PATCH 03/10] add node --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 1fa60a3..bcb4f13 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,6 +8,7 @@ RUN chmod +x /action/entrypoint.sh RUN apk update && \ apk upgrade && \ + apk add node && \ apk add git ENTRYPOINT ["/action/entrypoint.sh"] From 8eaa9c8102a73ed48085d4bddcf990e625e32c24 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Sun, 15 May 2022 12:50:13 +0700 Subject: [PATCH 04/10] don't update summary inside actions --- Dockerfile | 1 - entrypoint.sh | 3 --- 2 files changed, 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index bcb4f13..1fa60a3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,6 @@ RUN chmod +x /action/entrypoint.sh RUN apk update && \ apk upgrade && \ - apk add node && \ apk add git ENTRYPOINT ["/action/entrypoint.sh"] diff --git a/entrypoint.sh b/entrypoint.sh index 5dab4a5..098450c 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -48,9 +48,6 @@ else ${INPUT_PHPCS_BIN_PATH} ${WARNING_FLAG} --report=checkstyle --report-json=./phpcs.json --standard=${INPUT_STANDARD} --ignore=${EXCLUDES} --extensions=php ${INPUT_PATHS} fi -npx github:10up/phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md -cat phpcs.md >> $GITHUB_STEP_SUMMARY - status=$? echo "::remove-matcher owner=phpcs::" From d7cb288397cc9b2a8eee5f959f09ac271b4048be Mon Sep 17 00:00:00 2001 From: Tung Du Date: Sun, 15 May 2022 13:40:05 +0700 Subject: [PATCH 05/10] create extra_args flag to passing custom arguments --- action.yml | 4 ++++ entrypoint.sh | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 281eed9..a0a306e 100644 --- a/action.yml +++ b/action.yml @@ -34,6 +34,10 @@ inputs: description: 'Use local config if available' required: false default: 'false' + extra_args: + description: 'Passing extra arguments to the phpcs command' + required: false + default: '' runs: using: 'docker' image: 'Dockerfile' diff --git a/entrypoint.sh b/entrypoint.sh index 098450c..a85d837 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -43,9 +43,9 @@ else fi if [ "${HAS_CONFIG}" = true ] && [ "${INPUT_USE_LOCAL_CONFIG}" = "true" ] ; then - ${INPUT_PHPCS_BIN_PATH} ${WARNING_FLAG} --report=checkstyle --report-json=./phpcs.json + ${INPUT_PHPCS_BIN_PATH} ${WARNING_FLAG} --report=checkstyle ${EXTRA_ARGS} else - ${INPUT_PHPCS_BIN_PATH} ${WARNING_FLAG} --report=checkstyle --report-json=./phpcs.json --standard=${INPUT_STANDARD} --ignore=${EXCLUDES} --extensions=php ${INPUT_PATHS} + ${INPUT_PHPCS_BIN_PATH} ${WARNING_FLAG} --report=checkstyle --standard=${INPUT_STANDARD} --ignore=${EXCLUDES} --extensions=php ${INPUT_PATHS} ${EXTRA_ARGS} fi status=$? From a11d824f23339925acbe8bc86a0ec31990ed0d35 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Sun, 15 May 2022 13:43:34 +0700 Subject: [PATCH 06/10] update readme --- README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/README.md b/README.md index ecbfdbd..f1153d2 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ Available options (with default value): repo_branch: 'master' # Branch of Standard repository phpcs_bin_path: 'phpcs' # Custom PHPCS bin path use_local_config: 'false' # Use local config if available + extra_args: '' # Extra arguments passing to the command ``` ## Examples @@ -77,6 +78,30 @@ jobs: with: standard: 'WordPress-VIP-Go' ``` +### Display the linting result in the GitHub Actions summary + +```yaml +name: WPCS check + +on: pull_request + +jobs: + phpcs: + name: VIPCS + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: VIPCS check + uses: 10up/wpcs-action@stable + with: + standard: 'WordPress-VIP-Go' + extra_args: '--report-json=./phpcs.json' + - name: Update summary + run: | + npx github:10up/phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md + cat phpcs.md >> $GITHUB_STEP_SUMMARY + if: always() +``` ## Support Level From ebf8ffddf4bb895db97c1b444faacb7edaf84bf2 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Sun, 15 May 2022 14:32:52 +0700 Subject: [PATCH 07/10] fix flag variable name --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index a85d837..71e1d88 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -43,9 +43,9 @@ else fi if [ "${HAS_CONFIG}" = true ] && [ "${INPUT_USE_LOCAL_CONFIG}" = "true" ] ; then - ${INPUT_PHPCS_BIN_PATH} ${WARNING_FLAG} --report=checkstyle ${EXTRA_ARGS} + ${INPUT_PHPCS_BIN_PATH} ${WARNING_FLAG} --report=checkstyle ${INPUT_EXTRA_ARGS} else - ${INPUT_PHPCS_BIN_PATH} ${WARNING_FLAG} --report=checkstyle --standard=${INPUT_STANDARD} --ignore=${EXCLUDES} --extensions=php ${INPUT_PATHS} ${EXTRA_ARGS} + ${INPUT_PHPCS_BIN_PATH} ${WARNING_FLAG} --report=checkstyle --standard=${INPUT_STANDARD} --ignore=${EXCLUDES} --extensions=php ${INPUT_PATHS} ${INPUT_EXTRA_ARGS} fi status=$? From 9ca2affe6be39bee189a157dfc361a22cc8db69f Mon Sep 17 00:00:00 2001 From: Tung Du Date: Mon, 16 May 2022 15:35:07 +0700 Subject: [PATCH 08/10] force downloading the package --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f1153d2..ab0fb41 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ jobs: extra_args: '--report-json=./phpcs.json' - name: Update summary run: | - npx github:10up/phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md + npx --yes github:10up/phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md cat phpcs.md >> $GITHUB_STEP_SUMMARY if: always() ``` From 4b864cc254472ebde5f7b95b0d3a1270ef1fca28 Mon Sep 17 00:00:00 2001 From: Tung Du Date: Tue, 14 Jun 2022 16:55:59 +0700 Subject: [PATCH 09/10] Update change log for 1.3.4 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ef1b9c..9115b7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.3.4] - 2022-06-14 +### Added +- `EXTRA_ARGS` flag to support custom arguments. + ## [1.3.3] - 2022-04-12 ### Fixed - Wrong branch used in examples. @@ -32,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `phpcs_bin_path` and `installed_paths` options. [Unreleased]: https://github.com/10up/wpcs-action/compare/stable...develop +[1.3.3]: https://github.com/10up/wpcs-action/compare/v1.3.3...v1.3.4 [1.3.3]: https://github.com/10up/wpcs-action/compare/v1.3.2...v1.3.3 [1.3.2]: https://github.com/10up/wpcs-action/compare/v1.3.1...v1.3.2 [1.3.1]: https://github.com/10up/wpcs-action/compare/v1.3.0...v1.3.1 From 55d3376daaccd6925619497030ae373db7546a3d Mon Sep 17 00:00:00 2001 From: Jeffrey Paul Date: Tue, 14 Jun 2022 13:14:31 -0500 Subject: [PATCH 10/10] Update CHANGELOG.md --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9115b7a..459b3d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.3.4] - 2022-06-14 ### Added -- `EXTRA_ARGS` flag to support custom arguments. +- `EXTRA_ARGS` flag to support custom arguments (props [@dinhtungdu](https://github.com/dinhtungdu) via [#12](https://github.com/10up/wpcs-action/pull/12)). ## [1.3.3] - 2022-04-12 ### Fixed @@ -36,7 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `phpcs_bin_path` and `installed_paths` options. [Unreleased]: https://github.com/10up/wpcs-action/compare/stable...develop -[1.3.3]: https://github.com/10up/wpcs-action/compare/v1.3.3...v1.3.4 +[1.3.4]: https://github.com/10up/wpcs-action/compare/v1.3.3...v1.3.4 [1.3.3]: https://github.com/10up/wpcs-action/compare/v1.3.2...v1.3.3 [1.3.2]: https://github.com/10up/wpcs-action/compare/v1.3.1...v1.3.2 [1.3.1]: https://github.com/10up/wpcs-action/compare/v1.3.0...v1.3.1