Skip to content

Commit 0e75b5e

Browse files
committed
adding additional comment message
1 parent d5769a6 commit 0e75b5e

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ inputs:
3030
description: 'file name of main branch summary (master)'
3131
default: 'develop-coverage-summary.json'
3232

33+
additionalCommentInfo:
34+
description: 'Additional string that will be concatenated to comment'
35+
default: null
3336

3437
branding:
3538
color: red

dist/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2031,6 +2031,7 @@ function run() {
20312031
const githubToken = core.getInput('accessToken');
20322032
const fullCoverage = JSON.parse(core.getInput('fullCoverageDiff'));
20332033
const commandToRun = core.getInput('runCommand');
2034+
const additionalCommentInfo = core.getInput('additionalCommentInfo');
20342035
const delta = Number(core.getInput('delta'));
20352036
const rawTotalDelta = core.getInput('total_delta');
20362037
const mainBranchCoverageSummaryFileName = core.getInput('mainBranchCoverageSummaryFileName');
@@ -2052,9 +2053,7 @@ function run() {
20522053
const currentDirectory = child_process_1.execSync('pwd')
20532054
.toString()
20542055
.trim();
2055-
console.log('>>>>>> START DIFF CHECK');
20562056
const diffChecker = new DiffChecker_1.DiffChecker(codeCoverageNew, codeCoverageOld);
2057-
console.log('>>>>>> END DIFF CHECK');
20582057
let messageToPost = `## Test coverage results :test_tube: \n
20592058
Code coverage diff between base branch:${branchNameBase} and head branch: ${branchNameHead} \n\n`;
20602059
const coverageDetails = diffChecker.getCoverageDetails(!fullCoverage, `${currentDirectory}/`);
@@ -2079,6 +2078,9 @@ function run() {
20792078
}
20802079
messageToPost = `Current PR reduces the test coverage percentage by ${delta} for some tests`;
20812080
messageToPost = `${deltaCommentIdentifier}\nCommit SHA:${commitSha}\n${messageToPost}`;
2081+
if (additionalCommentInfo) {
2082+
messageToPost = `${messageToPost}\n${additionalCommentInfo}`;
2083+
}
20822084
yield createOrUpdateComment(commentId, githubClient, repoOwner, repoName, messageToPost, prNumber);
20832085
throw Error(messageToPost);
20842086
}

src/main.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ 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 additionalCommentInfo = core.getInput('additionalCommentInfo')
20+
1921
const delta = Number(core.getInput('delta'))
2022
const rawTotalDelta = core.getInput('total_delta')
2123
const mainBranchCoverageSummaryFileName = core.getInput(
@@ -48,12 +50,10 @@ async function run(): Promise<void> {
4850
const currentDirectory = execSync('pwd')
4951
.toString()
5052
.trim()
51-
console.log('>>>>>> START DIFF CHECK')
5253
const diffChecker: DiffChecker = new DiffChecker(
5354
codeCoverageNew,
5455
codeCoverageOld
5556
)
56-
console.log('>>>>>> END DIFF CHECK')
5757

5858
let messageToPost = `## Test coverage results :test_tube: \n
5959
Code coverage diff between base branch:${branchNameBase} and head branch: ${branchNameHead} \n\n`
@@ -101,6 +101,10 @@ async function run(): Promise<void> {
101101
}
102102
messageToPost = `Current PR reduces the test coverage percentage by ${delta} for some tests`
103103
messageToPost = `${deltaCommentIdentifier}\nCommit SHA:${commitSha}\n${messageToPost}`
104+
if (additionalCommentInfo) {
105+
messageToPost = `${messageToPost}\n${additionalCommentInfo}`
106+
}
107+
104108
await createOrUpdateComment(
105109
commentId,
106110
githubClient,

0 commit comments

Comments
 (0)