Apex PMD GitHub Actions #4041
-
Hello, I'm trying to get the PMD Github Action to work, but I'm currently stuck. When running the workflow it detects a changed file, but when running the PMD check it reports there is "no such file". I'm using attached yml (PMD.yml.txt), which seems alright, but the log then shows the following:
Please advise Regards, Jurgen PMD.yml: name: PMD Source Code Analyzer on PR
on:
pull_request:
branches:
- master
jobs:
pmd:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'temurin'
- uses: pmd/pmd-github-action@v1
id: pmd
with:
sourcePath: 'force-app/main/default/classes'
rulesets: 'rulesets/apex/quickstart.xml'
- name: Fail build if there a violations
if: steps.pmd.outputs.violations != 0
run: exit 1 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @jurgenvanwestreenen , I couldn't reproduce your problem - there doesn't seem to be a general problem. E.g. pmd/pmd-github-action-tests#8 works as expected (I also used the sourcePath parameter here). The action uses the GitHub API to determine the files, that have been modified in the PR - that's how we figure out, that But the error "No such file" we print only, if there is indeed no such file... Until now, we didn't access the local file system, we just used the GitHub API. Looking further, I'm missing in your workflow the step to checkout the repository... That's what I've done in the Test PR, I've created. I guess, that's the problem here. So, just add Regards, |
Beta Was this translation helpful? Give feedback.
Hi @jurgenvanwestreenen ,
I couldn't reproduce your problem - there doesn't seem to be a general problem. E.g. pmd/pmd-github-action-tests#8 works as expected (I also used the sourcePath parameter here).
The action uses the GitHub API to determine the files, that have been modified in the PR - that's how we figure out, that
force-app/main/default/classes/BotController.cls
needs to be analyzed.But the error "No such file" we print only, if there is indeed no such file... Until now, we didn't access the local file system, we just used the GitHub API.
Looking further, I'm missing in your workflow the step to checkout the repository... That's what I've done in the Test PR, I've created. I gu…