diff --git a/README.md b/README.md index 8505547..0de1666 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,7 @@ for [Creating a workflow file](https://help.github.com/en/articles/configuring-a - `fail-emoji` - [*optional* {default: :x:}] Emoji to use for fail status shown when 'coverage < min coverage' (should be a Github supported emoji). - `continue-on-error` - [*optional* {default: true}] If true, then do not fail the action on error, but log a warning - `debug-mode` - [*optional* {default: false}] If true, run the action in debug mode and get debug logs printed in console +- `summary-mode` - [*optional* {default: false}] If true, report the result to workflow summary ### Outputs diff --git a/action.yml b/action.yml index e95f18b..76c1691 100644 --- a/action.yml +++ b/action.yml @@ -42,6 +42,10 @@ inputs: description: 'Run the action in debug mode and get debug logs printed in console' required: false default: 'false' + summary-mode: + description: 'Report to workflow summary' + required: false + default: 'false' outputs: coverage-overall: diff --git a/dist/index.js b/dist/index.js index 90d2a84..8ddfeae 100644 --- a/dist/index.js +++ b/dist/index.js @@ -83,6 +83,7 @@ function action() { const failEmoji = core.getInput('fail-emoji'); continueOnError = (0, processors_1.parseBooleans)(core.getInput('continue-on-error')); const debugMode = (0, processors_1.parseBooleans)(core.getInput('debug-mode')); + const summaryMode = (0, processors_1.parseBooleans)(core.getInput('summary-mode')); const event = github.context.eventName; core.info(`Event is ${event}`); if (debugMode) { @@ -133,10 +134,17 @@ function action() { pass: passEmoji, fail: failEmoji, }; - yield addComment(prNumber, updateComment, (0, render_1.getTitle)(title), (0, render_1.getPRComment)(project, { + const comment = (0, render_1.getPRComment)(project, { overall: minCoverageOverall, changed: minCoverageChangedFiles, - }, title, emoji), client, debugMode); + }, title, emoji); + if (summaryMode) { + core.summary.addRaw(comment); + core.summary.write({overwrite: updateComment}); + } + else { + yield addComment(prNumber, updateComment, (0, render_1.getTitle)(title), comment, client, debugMode); + } } } catch (error) {