File tree Expand file tree Collapse file tree 2 files changed +8
-12
lines changed
Expand file tree Collapse file tree 2 files changed +8
-12
lines changed Original file line number Diff line number Diff line change 1- name : ' Jest Coverage Diff '
2- description : ' A github action to comment jest coverage diff on a PR'
3- author : ' Anuraag Puri '
1+ name : ' Jest coverage referencing main branch existing summary '
2+ description : ' A github action to comment jest coverage diff on a PR using current branch vs already existing main branch summary '
3+ author : ' Fadi Khayo '
44inputs :
55 accessToken :
66 description : ' access token required to comment on a pr'
@@ -11,9 +11,6 @@ inputs:
1111 runCommand :
1212 description : ' custom command to get json-summary'
1313 default : ' npx jest --coverage --coverageReporters="json-summary" --coverageDirectory="./"'
14- afterSwitchCommand :
15- description : ' command to run after switching to default branch'
16- default : null
1714 delta :
1815 description : ' Difference between the old and final test coverage'
1916 default : 100
@@ -23,6 +20,9 @@ inputs:
2320 useSameComment :
2421 description : ' While commenting on the PR update the exisiting comment'
2522 default : false
23+ main-branch-coverage-summary-file-name :
24+ description : ' file name of main branch summary (master)'
25+ default : ' develop-coverage-summary.json'
2626branding :
2727 color : red
2828 icon : git-pull-request
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ async function run(): Promise<void> {
1616 const githubToken = core . getInput ( 'accessToken' )
1717 const fullCoverage = JSON . parse ( core . getInput ( 'fullCoverageDiff' ) )
1818 const commandToRun = core . getInput ( 'runCommand' )
19- const commandAfterSwitch = core . getInput ( 'afterSwitchCommand' )
2019 const delta = Number ( core . getInput ( 'delta' ) )
2120 const rawTotalDelta = core . getInput ( 'total_delta' )
2221 const githubClient = github . getOctokit ( githubToken )
@@ -38,12 +37,9 @@ async function run(): Promise<void> {
3837 execSync ( '/usr/bin/git fetch' )
3938 execSync ( '/usr/bin/git stash' )
4039 execSync ( `/usr/bin/git checkout --progress --force ${ branchNameBase } ` )
41- if ( commandAfterSwitch ) {
42- execSync ( commandAfterSwitch )
43- }
44- execSync ( commandToRun )
40+
4541 const codeCoverageOld = < CoverageReport > (
46- JSON . parse ( fs . readFileSync ( 'coverage-summary.json' ) . toString ( ) )
42+ JSON . parse ( fs . readFileSync ( 'develop- coverage-summary.json' ) . toString ( ) )
4743 )
4844 const currentDirectory = execSync ( 'pwd' )
4945 . toString ( )
You can’t perform that action at this time.
0 commit comments