Skip to content

Commit 0291e7b

Browse files
committed
fix
1 parent feeeeae commit 0291e7b

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,32 @@ inputs:
55
accessToken:
66
description: 'access token required to comment on a pr'
77
default: ${{ github.token }}
8+
89
fullCoverageDiff:
910
description: 'get the full coverage with diff or only the diff'
1011
default: false
12+
1113
runCommand:
1214
description: 'custom command to get json-summary'
1315
default: 'npx jest --coverage --coverageReporters="json-summary" --coverageDirectory="./"'
16+
1417
delta:
1518
description: 'Difference between the old and final test coverage'
1619
default: 100
20+
1721
total_delta:
1822
description: 'Difference between the old and final test coverage at the total level'
1923
default: null
24+
2025
useSameComment:
2126
description: 'While commenting on the PR update the exisiting comment'
2227
default: false
28+
2329
main-branch-coverage-summary-file-name:
2430
description: 'file name of main branch summary (master)'
2531
default: 'develop-coverage-summary.json'
32+
33+
2634
branding:
2735
color: red
2836
icon: git-pull-request

src/DiffChecker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ export class DiffChecker {
1818
) {
1919
const reportNewKeys = Object.keys(coverageReportNew)
2020
const reportOldKeys = Object.keys(coverageReportOld)
21-
const reportKeys = new Set([...reportNewKeys, ...reportOldKeys])
21+
// const reportKeys = new Set([...reportNewKeys, ...reportOldKeys])
22+
const reportKeys = new Set([...reportNewKeys ])
2223

2324
for (const filePath of reportKeys) {
2425
this.diffCoverageReport[filePath] = {

src/main.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,28 @@ async function run(): Promise<void> {
2626
const commentIdentifier = `<!-- codeCoverageDiffComment -->`
2727
const deltaCommentIdentifier = `<!-- codeCoverageDeltaComment -->`
2828
let totalDelta = null
29+
2930
if (rawTotalDelta !== null) {
3031
totalDelta = Number(rawTotalDelta)
3132
}
33+
3234
let commentId = null
33-
execSync(commandToRun)
35+
execSync(`${commandToRun} -- --changeSince=origin/develop`)
36+
3437
const codeCoverageNew = <CoverageReport>(
3538
JSON.parse(fs.readFileSync('coverage-summary.json').toString())
3639
)
37-
execSync('/usr/bin/git fetch')
38-
execSync('/usr/bin/git stash')
39-
execSync(`/usr/bin/git checkout --progress --force ${branchNameBase}`)
40+
// execSync('/usr/bin/git fetch')
41+
// execSync('/usr/bin/git stash')
42+
// execSync(`/usr/bin/git checkout --progress --force ${branchNameBase}`)
4043

4144
const codeCoverageOld = <CoverageReport>(
4245
JSON.parse(fs.readFileSync('develop-coverage-summary.json').toString())
4346
)
4447
const currentDirectory = execSync('pwd')
4548
.toString()
4649
.trim()
50+
4751
const diffChecker: DiffChecker = new DiffChecker(
4852
codeCoverageNew,
4953
codeCoverageOld

0 commit comments

Comments
 (0)