Giter Site home page Giter Site logo

greatwizard / coverage-diff-action Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 7.0 296 KB

Publish diff coverage report as PR comment, and create a coverage badge to display on the readme.

License: MIT License

JavaScript 100.00%
angular angularjs badge coverage diff ember emberjs github-action istanbul jest json-summary react reactjs vue vuejs

coverage-diff-action's Introduction

Hi there ๐Ÿ‘‹

Github stats

Github Contribution Github Contribution

@greatwizard's Holopin board

coverage-diff-action's People

Contributors

greatwizard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

coverage-diff-action's Issues

[Possible Bug] Fails to find PR number

Hey there!

I've been attempting to add this action for a bit and figured out that it's failing to grab the PR number (const issue_number = context?.payload?.pull_request?.number;). It never enters this block on a fresh pull request and in the else statement (core.info(diff.results);), it outputs undefined.

I'm determined to add this action to our workflows but am having trouble getting it to work. I thought maybe the github context wouldn't have the correct path to grab the PR number if I was testing on a draft pull request but ran into the same issue without draft. Do you have any thoughts on why I'm seeing this output? I checked out the PR in the job.

      - name: Checkout PR
        if: github.event_name == 'pull_request_target'
        uses: actions/checkout@v3
        with:
          ref: ${{ github.event.pull_request.head.sha }}

Dumping the github context, I don't see the PR number anywhere. I created a new PR to see if its populated on the first commit/opening of the PR but the action still fails.

Thanks.

Fixed!

Missed pull_request: {} for push in the workflow header.

Error instead of information message at first launch on PR

The first time the action launches on a PR, the coverage file was never generated on the main branch yet and cannot be used to compare with the PR branch.

This case is supposed to show an information message, but for now it triggers an error:

[Error: ENOENT: no such file or directory, open 'coverage/coverage-summary.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: 'coverage/coverage-summary.json'
}

First time using action fails when `coverage-summary.json` does not exist

I am trying to set up this action for the first time and I'm getting errors running the action.

I have created a wiki page for the repo, but I do not yet have a coverage-summary.json file.

Do I need to create this file manually?

Cloning wiki repository...
undefined:1
<?xml version="1.0" encoding="utf-8"?>
^

SyntaxError: Unexpected token < in JSON at position 0
    at JSON.parse (<anonymous>)
    at run (/opt/actions-runner/_work/_actions/greatwizard/coverage-diff-action/v1.0.8/dist/index.js:14309:21)

Error on first run `Cannot convert undefined or null to object`

I am trying to set up a new job but I am getting the following error:

Object.keys(head.total).map((t) => head.total[t].pct),
           ^
TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at run (/home/runner/work/_actions/greatwizard/coverage-diff-action/v1.0.8/dist/index.js:[14](https://github.com/sirLisko/test-coverage/actions/runs/6283765741/job/17064535296#step:7:15)312:12)

This is the configuration:

      - name: Coverage Diff
        uses: greatwizard/[email protected]
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          coverage-filename: coverage/coverage-final.json

You can see the full job here https://github.com/sirLisko/test-coverage/blob/1d7eba8be0dbe5f47772dbb64d09dfa08d54a22d/.github/workflows/push_ci.yml#L29-L33.

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.