This is a GitHub action to run PMD check on your Java code and report status via reviewdog on pull request.
An example of how the reported pmd violations will look like on pull request is shown below (link to PR):
inputs:
github_token:
description: 'GITHUB_TOKEN'
default: '${{ github.token }}'
workdir:
description: 'Working directory relative to the root directory.'
default: '.'
### Flags for reviewdog ###
level:
description: 'Report level for reviewdog [info,warning,error]'
default: 'error'
reporter:
description: 'Reporter of reviewdog command [github-pr-check,github-pr-review].'
default: 'github-pr-check'
filter_mode:
description: |
Filtering mode for the reviewdog command [added,diff_context,file,nofilter].
Default is added.
default: 'added'
fail_on_error:
description: |
Exit code for reviewdog when errors are found [true,false]
Default is `false`.
default: 'false'
tool_name:
description: 'Tool name to use for reviewdog reporter'
default: 'pmd'
reviewdog_flags:
description: 'Additional reviewdog flags'
default: ''
### Flags for PMD ###
src_path:
description: 'Specify the directory where the sources to be analyzed are stored. Default is `src/main/java`.'
default: 'src/main/java'
rulesets_path:
description: 'Specify the path of the PMD rule set. Default is `rulesets/java/quickstart.xml`.'
default: 'rulesets/java/quickstart.xml'
name: pmd
on: [pull_request]
jobs:
pmd_job:
runs-on: ubuntu-latest
name: PMD job
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run PMD
uses: kemsakurai/action-pmd@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: 'github-pr-review'
tool_name: 'pmd_reviewdog'