Skip to content

Commit aaef680

Browse files
authored
fix: only display path in PR comment when not default (#31)
1 parent 508f4c7 commit aaef680

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ jobs:
2929
- name: Go Beautiful HTML Coverage
3030
uses: './'
3131
with:
32-
path: go-test-app-01
32+
path: go-test-app-01/
3333

3434
- name: Go Beautiful HTML Coverage
3535
uses: './'
3636
with:
37-
path: go-test-app-02
37+
path: go-test-app-02/

src/update-comment.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ const updateCodeCoverageComment = module.exports = async ({ context, github }, p
1414

1515
const coverageText = fs.readFileSync(`go-cover/${revision}.txt`, 'utf8').split('\n').slice(0, -1)
1616
const coverageTextSummary = coverageText[coverageText.length-1].split('\t').pop()
17+
const pathText = (path !== './' ? ` for \`${path}/\`` : '').replace('//', '/')
1718

1819
const commentBody = [
1920
`<!-- coverage (${path})-->`,
20-
`### [Code Coverage Report 🔗](https://${context.repo.owner}.github.io/${context.repo.repo}/?hash=${revision}) for \`${path}/\` at ${revision}`,
21+
`### [Code Coverage Report 🔗](https://${context.repo.owner}.github.io/${context.repo.repo}/?hash=${revision})${pathText} at ${revision}`,
2122
'```',
2223
`Total: ${coverageTextSummary}`,
2324
'```',

0 commit comments

Comments
 (0)