Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 --yes github:10up/phpcs-json-to-md --path ./phpcs.json --output ./phpcs.md
cat phpcs.md >> $GITHUB_STEP_SUMMARY
if: always()
```

## Support Level

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 2 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ${INPUT_EXTRA_ARGS}
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 --standard=${INPUT_STANDARD} --ignore=${EXCLUDES} --extensions=php ${INPUT_PATHS} ${INPUT_EXTRA_ARGS}
fi

status=$?
Expand Down