greatwizard / coverage-diff-action Goto Github PK
View Code? Open in Web Editor NEWPublish diff coverage report as PR comment, and create a coverage badge to display on the readme.
License: MIT License
Publish diff coverage report as PR comment, and create a coverage badge to display on the readme.
License: MIT License
would be nice if for a PR you can check against the target branch instead of using the main one
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.
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'
}
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)
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.
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.