Skip to content

Commit

Permalink
Add summary_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
yijhenlin committed Apr 11, 2024
1 parent 468b095 commit 4305a5a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 10 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 4305a5a

Please sign in to comment.