Skip to content

Commit ece4ccf

Browse files
jhen0409zgosalvez
andauthored
Add title input (#21)
* Add title input * Update README.md * Elaboration * Run prepare * Update index.js.map Co-authored-by: Zennon Gosalvez <1798166+zgosalvez@users.noreply.github.com>
1 parent 54da59f commit ece4ccf

File tree

5 files changed

+9
-3
lines changed

5 files changed

+9
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ For more information on these inputs, see the [Workflow syntax for GitHub Action
1717
- `minimum-coverage`: The minimum coverage to pass the check. Optional. Default: `0` (always passes)
1818
- `github-token`: Set the `${{ secrets.GITHUB_TOKEN }}` token to have the action comment the coverage summary in the pull request. This token is provided by Actions, you do not need to create your own token. Optional. Default: ``
1919
- `working-directory`: The working directory containing the source files referenced in the LCOV files. Optional. Default: `./`
20+
- `title`: A prefix before the title "LCOV of commit..." Optional. Default: ``
2021

2122
### Outputs
2223
None.

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ inputs:
1616
description: 'Set the GitHub token to have the action comment the coverage summary in the pull request. This token is provided by Actions, you do not need to create your own token. Optional. Default: ``'
1717
working-directory:
1818
description: 'The working directory containing the source files referenced in the LCOV files. Optional. Default: `./`'
19+
title-prefix:
20+
description: 'A prefix before the title "LCOV of commit..." Optional. Default: ``'
21+
required: false
1922
runs:
2023
using: 'node12'
2124
main: 'dist/main/index.js'

dist/main/index.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ async function run() {
1717
const coverageFilesPattern = core.getInput('coverage-files');
1818
const globber = await glob.create(coverageFilesPattern);
1919
const coverageFiles = await globber.glob();
20+
const title = core.getInput('title');
2021

2122
await genhtml(coverageFiles, tmpPath);
2223

@@ -33,7 +34,7 @@ async function run() {
3334
const details = await detail(coverageFile, octokit);
3435
const sha = github.context.payload.pull_request.head.sha;
3536
const shaShort = sha.substr(0, 7);
36-
let body = `### [LCOV](https://github.com/marketplace/actions/report-lcov) of commit [<code>${shaShort}</code>](${github.context.payload.pull_request.number}/commits/${sha}) during [${github.context.workflow} #${github.context.runNumber}](../actions/runs/${github.context.runId})\n<pre>${summary}\n\nFiles changed coverage rate:${details}</pre>`;
37+
let body = `### ${title ? `${title} ` : ''}[LCOV](https://github.com/marketplace/actions/report-lcov) of commit [<code>${shaShort}</code>](${github.context.payload.pull_request.number}/commits/${sha}) during [${github.context.workflow} #${github.context.runNumber}](../actions/runs/${github.context.runId})\n<pre>${summary}\n\nFiles changed coverage rate:${details}</pre>`;
3738

3839
if (isFailure) {
3940
body += `\n:no_entry: ${errorMessage}`;

0 commit comments

Comments
 (0)