jwgmeligmeyling / pmd-github-action Goto Github PK
View Code? Open in Web Editor NEWPush PMD results as check run annotations
License: MIT License
Push PMD results as check run annotations
License: MIT License
Hi, I tried to use your action but I found a bug on pull_request
builds. It took me some builds to find out that the action was correctly reporting violations but not on the correct build.
On my last attempt tried to use this option of the checkout action but strangely the check was still added to the merge commit :
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
I looked a little bit at your code and I wonder if using context.ref
when the check is created instead of context.sha
would solve this problem (when the above option is set in the checkout action).
To support the workflow_run use case it is necessary to specify the commit to upload annotations against.
Here is an example of an action that provides this capability: https://github.com/ScaCap/action-surefire-report and here is the relevant code https://github.com/ScaCap/action-surefire-report/blob/master/action.js#L28
const commit = core.getInput('commit');
...
const head_sha = commit || (pullRequest && pullRequest.head.sha) || github.context.sha;
...
const createCheckRequest = {
...github.context.repo,
name,
head_sha,
status,
conclusion,
output: {
title,
summary: '',
annotations: annotations.slice(0, 50)
}
};
Here is an example usage of this feature: https://github.com/apache/spark/blob/master/.github/workflows/test_report.yml#L24
I think this should be relatively straight forward to add to this action, and would impact this area of code:
https://github.com/jwgmeligmeyling/pmd-github-action/blob/master/src/main.ts#L59
let sha = context.sha
if (context.payload.pull_request) {
sha = context.payload.pull_request.head.sha
}
Github Actions run within a Workflow Run. Each Workflow Run is associated with its own Check Suite. Whenever we post a Check Run, a Check Suite is created unless a Check Suite for that application already exists. However, when multiple workflows are triggered for an event (or multiple events trigger multiple runs of the same workflow) , multiple possible Workflow Runs and thus multiple Check Suites will be available. Unfortunately, there is no way for us to pick a Check Suite when creating a new Check Run. This is a limitation in the Github Checks API. As a result, currently results generated during workflows on a pull_request
event might end up at the push
workflow, if both events are used together.
(The interesting part about this image is that the "build-test PMD" run was created during "build-test on: pull request".
See also: https://github.community/t/specify-check-suite-when-creating-a-checkrun/118380?u=jwgmeligmeyling
Split off from #2
Feature Request: Allow PMD CPD Report to be published. Currently, the PMD CPD report which is in XML format is not getting published. i tried.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.