Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
umbrella

GitHub Action

Push PMD report

v1

Push PMD report

umbrella

Push PMD report

Push PMD Code Analysis report

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Push PMD report

uses: jwgmeligmeyling/pmd-github-action@v1

Learn more about this action in jwgmeligmeyling/pmd-github-action

Choose a version

build-test

PMD GitHub Action

This action pushes results from PMD as check run annotations. 🚀

The action can also be used for any other static analysis tools that produce reports in the PMD XML format. The report itself must be generated in a former build step, for example a Maven build.

example

Input

path

Required. A file, directory or wildcard pattern that describes where to find the reports. Multiple files can be processed through a glob expression, for example: '**/pmd.xml'.

name

Optional. Name for the check run to create. Defaults to PMD.

title

Optional. Title for the check run to create. Defaults to PMD Source Code Analyzer report.

token

Optional. GitHub API access token. Defaults to ${{ github.token }}, which is set by actions/checkout@v2 minimally.

Example usage

name: Java CI

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Set up JDK 1.8
      uses: actions/setup-java@v1
      with:
        java-version: 1.8
    - uses: actions/cache@v1
      with:
        path: ~/.m2/repository
        key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
        restore-keys: |
          ${{ runner.os }}-maven-
    - name: Build with Maven
      run: mvn -B verify pmd:pmd
    - uses: jwgmeligmeyling/pmd-github-action@v1
      with:
        path: '**/pmd.xml'

And do not forget to enable XML output for the Maven plugin:

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-pmd-plugin</artifactId>
      <version>3.13.0</version>
      <configuration>
        <includeTests>true</includeTests>
        <failOnViolation>false</failOnViolation>
        <skipEmptyReport>false</skipEmptyReport>
      </configuration>
    </plugin>
  </plugins>
</build>

Contributing

Install the dependencies

$ npm install

Build the typescript and package it for distribution

$ npm run build && npm run pack

Run the tests ✔️

$ npm test

 PASS  ./index.test.js
  ✓ throws invalid number (3ms)
  ✓ wait 500 ms (504ms)
  ✓ test runs (95ms)

...