lcov-reporter-action icon indicating copy to clipboard operation
lcov-reporter-action copied to clipboard

The action fails with undefined error

Open charklewis opened this issue 2 years ago • 4 comments

I am trying to use this action however it always fails with:

TypeError: Cannot read property 'number' of undefined
[5](https://github.com/my-repo/runs/6051899683?check_suite_focus=true#step:7:5)
    at main$1 (/home/runner/work/_actions/romeovs/lcov-reporter-action/v0.2.11/dist/main.js:22921:2[6](https://github.com/my-repo/runs/6051899683?check_suite_focus=true#step:7:6))
6
Error: Cannot read property 'number' of undefined

Can you help me debug this?

charklewis avatar Apr 17 '22 05:04 charklewis

I have the same issue just using the example with workflow_dispatch event trigger

- name: publish
   uses: romeovs/[email protected]
   with:
     lcov-file: ./coverage.lcov

@romeovs hello! do you have any time to check this?

Birdi7 avatar Apr 22 '22 12:04 Birdi7

This error usually occurs when the workflow did not run on a "pull_request" event (e.g. ran on a "push").

You can inspect the github.event_name context property (https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context) which contains the name of the event that triggered the workflow run to ensure that the code coverage report step will only run on PRs.

For example:

- uses: romeovs/[email protected]
  if: github.event_name == 'pull_request'

guilhermeagostinelli avatar Jun 14 '22 19:06 guilhermeagostinelli

How can I run the coverage report on a pull request, then?

The even I get when a pull request is updated is 'push'.

hramrach avatar Jan 27 '24 11:01 hramrach

Nevermind, that's determined by the selected action type in the workflow, both push and pull_request happen on updating a PR.

hramrach avatar Jan 27 '24 11:01 hramrach