Skip to content

Commit

Permalink
Add new exclude-checks input (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy authored Nov 7, 2023
1 parent b136356 commit 51a8786
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
10 changes: 10 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,13 @@ jobs:
continue-on-error: true # Since we expect it to always fail for the test plugin.
with:
build-dir: 'build'

- name: Run plugin check
uses: ./
continue-on-error: true # Since we expect it to always fail for the test plugin.
with:
build-dir: 'build'
exclude-checks: |
late_escaping
plugin_readme
include-experimental: true
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ See [action.yml](action.yml)
# Default: ''
checks: ''

# List of checks to exclude from running.
# Each check should be separated with new lines.
# Examples: i18n_usage, file_type, late_escaping.
# Applies after the `checks` input.
#
# Default: ''
exclude-checks: ''

# List of categories to limit checks to.
# Each category should be separated with new lines.
# Examples: general, security
Expand Down
8 changes: 7 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ inputs:
description: 'Only run specific checks'
required: false
default: ''
exclude-checks:
description: 'Checks to exclude'
required: false
default: ''
categories:
description: 'Limit checks to specific categories'
required: false
Expand Down Expand Up @@ -106,14 +110,16 @@ runs:
- name: Run Plugin Check
run: |
CHECKS="${CHECKS//$'\n'/,}"
EXCLUDE_CHECKS="${EXCLUDE_CHECKS//$'\n'/,}"
CATEGORIES="${CATEGORIES//$'\n'/,}"
EXCLUDE_DIRS="${EXCLUDE_DIRS//$'\n'/,}"
ADDITIONAL_ARGS="$CHECKS $CATEGORIES $IGNORE_WARNINGS $IGNORE_ERRORS $INCLUDE_EXPERIMENTAL $EXCLUDE_DIRS"
ADDITIONAL_ARGS="$CHECKS $EXCLUDE_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) || '' }}
EXCLUDE_CHECKS: ${{ inputs.exclude-checks && format('--exclude-checks={0}', inputs.exclude-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' || '' }}
Expand Down

0 comments on commit 51a8786

Please sign in to comment.