@@ -18,8 +18,9 @@ async function run() {
1818 const titlePrefix = core . getInput ( 'title-prefix' ) ;
1919 const additionalMessage = core . getInput ( 'additional-message' ) ;
2020 const updateComment = core . getInput ( 'update-comment' ) === 'true' ;
21+ const workingDirectory = core . getInput ( 'working-directory' ) . trim ( ) || './' ;
2122
22- await genhtml ( coverageFiles , tmpPath ) ;
23+ await genhtml ( coverageFiles , tmpPath , workingDirectory ) ;
2324
2425 const coverageFile = await mergeCoverages ( coverageFiles , tmpPath ) ;
2526 const totalCoverage = lcovTotal ( coverageFile ) ;
@@ -34,7 +35,7 @@ async function run() {
3435 if ( hasGithubToken && isPR ) {
3536 const octokit = await github . getOctokit ( gitHubToken ) ;
3637 const summary = await summarize ( coverageFile ) ;
37- const details = await detail ( coverageFile , octokit ) ;
38+ const details = await detail ( coverageFile , workingDirectory , octokit ) ;
3839 const sha = github . context . payload . pull_request . head . sha ;
3940 const shaShort = sha . substr ( 0 , 7 ) ;
4041 const commentHeaderPrefix = `### ${ titlePrefix ? `${ titlePrefix } ` : '' } [LCOV](https://github.com/marketplace/actions/report-lcov) of commit` ;
@@ -101,8 +102,7 @@ async function upsertComment(body, commentHeaderPrefix, octokit) {
101102 }
102103}
103104
104- async function genhtml ( coverageFiles , tmpPath ) {
105- const workingDirectory = core . getInput ( 'working-directory' ) . trim ( ) || './' ;
105+ async function genhtml ( coverageFiles , tmpPath , workingDirectory ) {
106106 const artifactName = core . getInput ( 'artifact-name' ) . trim ( ) ;
107107 const artifactPath = path . resolve ( tmpPath , 'html' ) . trim ( ) ;
108108 const args = [ ...coverageFiles , '--rc' , 'lcov_branch_coverage=1' ] ;
@@ -178,7 +178,7 @@ async function summarize(coverageFile) {
178178 return lines . join ( '\n' ) ;
179179}
180180
181- async function detail ( coverageFile , octokit ) {
181+ async function detail ( coverageFile , workingDirectory , octokit ) {
182182 let output = '' ;
183183
184184 const options = { } ;
@@ -222,7 +222,7 @@ async function detail(coverageFile, octokit) {
222222 for ( const changedFile of changedFiles ) {
223223 console . log ( `${ line } === ${ changedFile } ` ) ;
224224
225- if ( line . startsWith ( changedFile ) ) return true ;
225+ if ( path . join ( workingDirectory , line ) . startsWith ( changedFile ) ) return true ;
226226 }
227227
228228 return false ;
0 commit comments