|
1 | | -# action-template |
| 1 | +# action-pmd |
2 | 2 |
|
3 | | -<!-- TODO: replace kemsakurai/action-pmd with your repo name --> |
4 | 3 | [](https://github.com/kemsakurai/action-pmd/actions?query=workflow%3ATest) |
5 | 4 | [](https://github.com/kemsakurai/action-pmd/actions?query=workflow%3Areviewdog) |
6 | 5 | [](https://github.com/kemsakurai/action-pmd/actions?query=workflow%3Adepup) |
7 | 6 | [](https://github.com/kemsakurai/action-pmd/actions?query=workflow%3Arelease) |
8 | 7 | [](https://github.com/kemsakurai/action-pmd/releases) |
9 | 8 | [](https://github.com/haya14busa/action-bumpr) |
10 | 9 |
|
| 10 | +This is a GitHub action to run [PMD](https://github.com/pmd/pmd) check on your Java code and report status via [reviewdog](https://github.com/reviewdog/reviewdog) on pull request. |
| 11 | + |
| 12 | +## Example |
| 13 | + |
| 14 | +An example of how the reported pmd violations will look like on pull request is shown below ([link to PR](https://github.com/kemsakurai/mixcloud-java-api/pull/5)): |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +## Inputs |
| 19 | +```yaml |
| 20 | +inputs: |
| 21 | + github_token: |
| 22 | + description: 'GITHUB_TOKEN' |
| 23 | + default: '${{ github.token }}' |
| 24 | + workdir: |
| 25 | + description: 'Working directory relative to the root directory.' |
| 26 | + default: '.' |
| 27 | + ### Flags for reviewdog ### |
| 28 | + level: |
| 29 | + description: 'Report level for reviewdog [info,warning,error]' |
| 30 | + default: 'error' |
| 31 | + reporter: |
| 32 | + description: 'Reporter of reviewdog command [github-pr-check,github-pr-review].' |
| 33 | + default: 'github-pr-check' |
| 34 | + filter_mode: |
| 35 | + description: | |
| 36 | + Filtering mode for the reviewdog command [added,diff_context,file,nofilter]. |
| 37 | + Default is added. |
| 38 | + default: 'added' |
| 39 | + fail_on_error: |
| 40 | + description: | |
| 41 | + Exit code for reviewdog when errors are found [true,false] |
| 42 | + Default is `false`. |
| 43 | + default: 'false' |
| 44 | + reviewdog_flags: |
| 45 | + description: 'Additional reviewdog flags' |
| 46 | + default: '' |
| 47 | + ### Flags for PMD ### |
| 48 | + src_path: |
| 49 | + description: 'Specify the directory where the sources to be analyzed are stored. Default is `src/main/java`.' |
| 50 | + default: 'src/main/java' |
| 51 | + rulesets_path: |
| 52 | + description: 'Specify the path of the PMD rule set. Default is `rulesets/java/quickstart.xml`.' |
| 53 | + default: 'rulesets/java/quickstart.xml' |
| 54 | +``` |
| 55 | +
|
11 | 56 | ## Usage |
12 | 57 |
|
13 | 58 | ```yaml |
14 | | -name: reviewdog |
| 59 | +name: pmd |
15 | 60 | on: [pull_request] |
16 | 61 | jobs: |
17 | 62 | pmd_job: |
|
24 | 69 | uses: kemsakurai/action-pmd@master |
25 | 70 | with: |
26 | 71 | github_token: ${{ secrets.GITHUB_TOKEN }} |
27 | | - reporter: 'github-pr-check' |
28 | | - tool_name: 'testtool' |
| 72 | + reporter: 'github-pr-review' |
| 73 | + tool_name: 'pmd_reviewdog' |
29 | 74 | ``` |
0 commit comments