File tree 2 files changed +8
-12
lines changed
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 '
4
4
inputs :
5
5
accessToken :
6
6
description : ' access token required to comment on a pr'
@@ -11,9 +11,6 @@ inputs:
11
11
runCommand :
12
12
description : ' custom command to get json-summary'
13
13
default : ' npx jest --coverage --coverageReporters="json-summary" --coverageDirectory="./"'
14
- afterSwitchCommand :
15
- description : ' command to run after switching to default branch'
16
- default : null
17
14
delta :
18
15
description : ' Difference between the old and final test coverage'
19
16
default : 100
@@ -23,6 +20,9 @@ inputs:
23
20
useSameComment :
24
21
description : ' While commenting on the PR update the exisiting comment'
25
22
default : false
23
+ main-branch-coverage-summary-file-name :
24
+ description : ' file name of main branch summary (master)'
25
+ default : ' develop-coverage-summary.json'
26
26
branding :
27
27
color : red
28
28
icon : git-pull-request
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ async function run(): Promise<void> {
16
16
const githubToken = core . getInput ( 'accessToken' )
17
17
const fullCoverage = JSON . parse ( core . getInput ( 'fullCoverageDiff' ) )
18
18
const commandToRun = core . getInput ( 'runCommand' )
19
- const commandAfterSwitch = core . getInput ( 'afterSwitchCommand' )
20
19
const delta = Number ( core . getInput ( 'delta' ) )
21
20
const rawTotalDelta = core . getInput ( 'total_delta' )
22
21
const githubClient = github . getOctokit ( githubToken )
@@ -38,12 +37,9 @@ async function run(): Promise<void> {
38
37
execSync ( '/usr/bin/git fetch' )
39
38
execSync ( '/usr/bin/git stash' )
40
39
execSync ( `/usr/bin/git checkout --progress --force ${ branchNameBase } ` )
41
- if ( commandAfterSwitch ) {
42
- execSync ( commandAfterSwitch )
43
- }
44
- execSync ( commandToRun )
40
+
45
41
const codeCoverageOld = < CoverageReport > (
46
- JSON . parse ( fs . readFileSync ( 'coverage-summary.json' ) . toString ( ) )
42
+ JSON . parse ( fs . readFileSync ( 'develop- coverage-summary.json' ) . toString ( ) )
47
43
)
48
44
const currentDirectory = execSync ( 'pwd' )
49
45
. toString ( )
You can’t perform that action at this time.
0 commit comments