Skip to content

Commit

Permalink
Report PMD results on pull requests
Browse files Browse the repository at this point in the history
Signed-off-by: Sven Strickroth <email@cs-ware.de>
  • Loading branch information
csware committed Jul 23, 2024
1 parent 48a29a6 commit 140d90a
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/pmd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

name: PMD

on:
pull_request:
paths:
- '.github/workflows/pmd.yml'
- 'pom.xml'
- 'pmd-ruleset.xml'
- 'src/main/java/**'

permissions:
contents: read

jobs:
PMD:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up JDK
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
java-version: 21
distribution: 'temurin'
cache: maven
- uses: reviewdog/action-setup@3f401fe1d58fe77e10d665ab713057375e39b887 # v0.20.1
name: Set up reviewdog
with:
reviewdog_version: latest
- name: Run PMD
run: mvn --batch-mode --errors --fail-at-end --show-version -Dgpg.skip -Djava.awt.headless=true -Dformat=net.sourceforge.pmd.renderers.SarifRenderer pmd:pmd
- name: Upload check results
env:
WORKDIR: ./
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
[ -s target/pmd.sarif.json ] && cat target/pmd.sarif.json | reviewdog -f=sarif -name="PMD" -reporter=github-pr-check -filter-mode=added -fail-on-error=false

0 comments on commit 140d90a

Please sign in to comment.