A GitHub action to run Plugin Check against your plugin.
Results are posted as file annotations.
![Plugin Check error messages output on GitHub Actions](https://private-user-images.githubusercontent.com/841956/276903860-31292472-51d5-487d-9878-1940a20e1e0b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA1MzQwOTgsIm5iZiI6MTcyMDUzMzc5OCwicGF0aCI6Ii84NDE5NTYvMjc2OTAzODYwLTMxMjkyNDcyLTUxZDUtNDg3ZC05ODc4LTE5NDBhMjBlMWUwYi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcwOVQxNDAzMThaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xZjFiYTRiZjUyNTVkYjQyZWUxMmM1M2Y4M2ZhY2Q2N2RhMDFmNjQ3ZGRkOGIyYmM0MjY4NTYxNzRkOGE3OTM4JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.RCJRLo9aMNpe0IiT9nJAYGQ9GtkKioYHwQ3KnFd27wg)
See action.yml
- uses: swissspidy/wp-plugin-check-action@v1
with:
# Personal access token (PAT) used to comment on pull requests.
# Not currently used.
#
# [Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)
#
# Default: ${{ github.token }}
repo-token: ''
# Build directory of your plugin.
# Defaults to current directory / repository root.
#
# Default: './'
build-dir: ''
# List of checks to run.
# Each check should be separated with new lines.
# Examples: i18n_usage, file_type, late_escaping.
# By default, all checks are run.
#
# 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
# By default, checks in all categories are run.
#
# Default: ''
categories: ''
# List of directories to exclude from checks.
# Each category should be separated with new lines.
#
# Default: ''
exclude-directories: ''
# Whether to ignore warnings reported by Plugin Check.
#
# Default: false
ignore-warnings: ''
# Whether to ignore errors reported by Plugin Check.
#
# Default: false
ignore-errors: ''
# Whether to include experimental checks.
#
# Default: true
include-experimental: ''
The simplest way to get up and running with your plugin.
Add a workflow (.github/workflows/build-test.yml
):
name: 'build-test'
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- main
- 'releases/*'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run plugin check
uses: swissspidy/wp-plugin-check-action@v1
The basic example above covers many use cases, but sometimes plugins can be a bit more complex and involve some sort of build process. Also, if you already use tools like PHPCS, you might want to use the PHPCS-based checks from Plugin Check but focus on the ones that are more useful for you.
steps:
- name: Checkout
uses: actions/checkout@v3
# Here's where you would run your custom build process
# ...
# ...
- name: Build plugin
run: npm run build
- name: Run plugin check
uses: swissspidy/wp-plugin-check-action@v1
with:
build-dir: './my-awesome-plugin'
exclude-directories: 'prefixed_vendor_dir,another_dir_to_ignore'
categories: |
performance
accessibility
At the moment, the following checks exist:
i18n_usage
enqueued_scripts_size
code_obfuscation
file_type
plugin_header_text_domain
late_escaping
plugin_updater
plugin_review_phpcs
performant_wp_query_params
enqueued_scripts_in_footer
plugin_readme
enqueued_styles_scope
localhost
no_unfiltered_uploads
trademarks
At the moment, the following categories exist:
general
plugin_repo
security
performance
accessibility