forked from synergy-au/pmd-analyser-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
46 lines (46 loc) · 2.17 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: 'PMD Analyser'
description: 'Runs PMD Source Code Analyser based on the ruleset defined - https://pmd.github.io/'
branding:
icon: 'zoom-in'
color: 'yellow'
inputs:
analyse-all-code:
description: 'Used to determine whether you just want to analyse the files changed or the whole repository.'
required: false
default: 'false'
error-rules:
description: 'If you wish to define rules that log as an error, enter each rule name separated with a comma and no spaces. Note that if an error is identified the run will fail. e.g. ClassNamingConventions,GuardLogStatement'
required: false
file-path:
description: 'Path to the sources to analyse. This can be a file name, a directory, or a jar or zip file containing the sources.'
required: true
pmd-version:
description: 'The version of PMD you would like to run.'
required: false
default: '6.33.0'
rules-path:
description: 'The ruleset file you want to use. PMD uses xml configuration files, called rulesets, which specify which rules to execute on your sources. You can also run a single rule by referencing it using its category and name (more details here). For example, you can check for unnecessary modifiers on Java sources with -R category/java/codestyle.xml/UnnecessaryModifier.'
required: true
runs:
using: "composite"
steps:
- id: branches
run: |
if [ ${{ github.event_name }} == 'pull_request' ]; then
echo "::set-output name=target::${{ github.base_ref }}"
echo "::set-output name=source::${{ github.head_ref }}"
else
echo "::set-output name=target::${{ github.event.repository.default_branch }}"
echo "::set-output name=source::${{ github.ref }}"
fi
shell: bash
- run: ${{ github.action_path }}/pmd-analyser.sh
shell: bash
env:
PMD_VERSION: ${{ inputs.pmd-version }}
FILE_PATH: ${{ inputs.file-path }}
RULES_PATH: ${{ inputs.rules-path }}
ANALYSE_ALL_CODE: ${{ inputs.analyse-all-code }}
TARGET_BRANCH: ${{ steps.branches.outputs.target }}
SOURCE_BRANCH: ${{ steps.branches.outputs.source }}
ERROR_RULES: ${{ inputs.error-rules }}