Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Delta Coverage Action

## 1.1

- Added custom script to generate extra check run content

## 1.0

- Now the action generates coverage badges for each test view.
Expand Down
14 changes: 13 additions & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ inputs:
required: false
default: 'delta-coverage'

check-run-extra-render-script:
description: 'Script to render additional info in check run.'
required: false
default: ''

outputs:
badges-dir:
description: 'Directory with generated badges.'
Expand Down Expand Up @@ -95,14 +100,21 @@ runs:
github-token: ${{ inputs.github-token }}
script: |
const createCheckRuns = require('${{ github.action_path }}/src/create-check-runs.js');
const extraRenderScript = (view) => {
const script = ${{ inputs.check-run-extra-render-script || '(v) => ""' }};
try { return script(view) } catch(e) {
return `Error in custom script: ${e}`
};
};
const checkRuns = await createCheckRuns({
summaryReportPath: `${{ steps.all-summaries.outputs.delta }}`,
ignoreCoverageFailure: ${{ steps.check-suppress.outputs.suppress }},
core: core,
context: context,
github: github,
headSha: `${{ github.event.pull_request.head.sha || github.sha }}`,
externalId: `${{ inputs.external-id }}`
externalId: `${{ inputs.external-id }}`,
summaryExtraFun: extraRenderScript
});
core.setOutput('check-runs', checkRuns);

Expand Down
3 changes: 2 additions & 1 deletion src/create-check-runs.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ module.exports = async (ctx) => {
const createCheckRun = async (view) => {
const conclusion = computeViewConclusion(view);
const viewName = capitalize(view.view);
const summary = `${readViewMarkdownReport(view)}\n\n<!-- This is Delta Coverage CheckRun -->`;
const summaryExtra = ctx.summaryExtraFun ? ctx.summaryExtraFun(view) : '';
const summary = `${readViewMarkdownReport(view)}\n\n<!-- This is Delta Coverage CheckRun -->\n${summaryExtra}`;

const response = await ctx.github.rest.checks.create({
owner: ctx.context.repo.owner,
Expand Down