Giter Club home page Giter Club logo

pmd-github-action's People

Contributors

jwgmeligmeyling avatar mchenryc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pmd-github-action's Issues

PMD annotations are added in an (Unknown event) in a (Unnamed workflow) when used in a pull request build

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).

Feature Request: Ability to specify commit (support workflow_run)

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
  }

Check run result is pushed to any workflow, rather than the executing workflow

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.

84824386-2423f600-b020-11ea-9adb-b5ca28894442

(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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.