From 3d9f6d08b345738e34faffad76e683cedadfbdca Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Tue, 31 Oct 2023 09:35:47 +0100 Subject: [PATCH] Add `--exclude-directories` support Depends on WordPress/plugin-check#311 --- README.md | 2 ++ action.yml | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 567f251..c6493a0 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,8 @@ The following inputs are supported: **Note:** file annotations will still be made against the source files. * `checks` (string): only run specific checks, separated by comma or newline. * `categories` (string): only run checks from specific categories, separated by comma or newline. +* `exclude-directories` (string): additional directories to exclude from checks, separated by comma or newline. + By default, `.git`, `vendor` and `node_modules` directories are excluded. * `ignore-warnings` (bool): ignore warnings. * `ignore-errors` (bool): ignore errors. * `include-experimental` (bool): include experimental checks. diff --git a/action.yml b/action.yml index aa8ce42..58f256c 100644 --- a/action.yml +++ b/action.yml @@ -21,6 +21,10 @@ inputs: description: 'Limit checks to specific categories' required: false default: '' + exclude-directories: + description: 'Exclude certain directories from checks' + required: false + default: '' ignore-warnings: description: 'Ignore warnings' required: false @@ -103,13 +107,15 @@ runs: run: | CHECKS="${CHECKS//$'\n'/,}" CATEGORIES="${CATEGORIES//$'\n'/,}" - ADDITIONAL_ARGS="$CHECKS $CATEGORIES $IGNORE_WARNINGS $IGNORE_ERRORS $INCLUDE_EXPERIMENTAL" + EXCLUDE_DIRS="${EXCLUDE_DIRS//$'\n'/,}" + ADDITIONAL_ARGS="$CHECKS $CATEGORIES $IGNORE_WARNINGS $IGNORE_ERRORS $INCLUDE_EXPERIMENTAL $EXCLUDE_DIRS" wp-env run cli wp plugin list wp-env run cli wp plugin check $PLUGIN_SLUG --format=json $ADDITIONAL_ARGS --require=./wp-content/plugins/plugin-check/cli.php > ${{ runner.temp }}/plugin-check-results.txt shell: bash env: CHECKS: ${{ inputs.checks && format('--checks={0}', inputs.checks) || '' }} CATEGORIES: ${{ inputs.categories && format('--categories={0}', inputs.categories) || '' }} + EXCLUDE_DIRS: ${{ inputs.exclude-directories && format('--exclude-directories={0}', inputs.exclude-directories) || '' }} IGNORE_WARNINGS: ${{ inputs.ignore-warnings == 'true' && '--ignore-warnings' || '' }} IGNORE_ERRORS: ${{ inputs.ignore-errors == 'true' && '--ignore-errors' || '' }} INCLUDE_EXPERIMENTAL: ${{ inputs.include-experimental == 'true' && '--include-experimental' || '' }}