mirror of
https://github.com/dorny/test-reporter.git
synced 2026-03-21 23:52:12 +01:00
feat: removing parameter, generating slug prefix and providing it as an output
This commit is contained in:
parent
7f0723a953
commit
08dfe2715b
4 changed files with 11 additions and 10 deletions
|
|
@ -162,10 +162,6 @@ jobs:
|
||||||
# Allows you to generate reports for Actions Summary
|
# Allows you to generate reports for Actions Summary
|
||||||
# https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/
|
# https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/
|
||||||
use-actions-summary: 'true'
|
use-actions-summary: 'true'
|
||||||
|
|
||||||
# Prefix used when generating report anchor slugs.
|
|
||||||
# Useful to avoid collisions when multiple reports are rendered together.
|
|
||||||
slug-prefix: ''
|
|
||||||
|
|
||||||
# Optionally specify a title (Heading level 1) for the report. Leading and trailing whitespace are ignored.
|
# Optionally specify a title (Heading level 1) for the report. Leading and trailing whitespace are ignored.
|
||||||
# This is useful for separating your test report from other sections in the build summary.
|
# This is useful for separating your test report from other sections in the build summary.
|
||||||
|
|
@ -216,6 +212,7 @@ jobs:
|
||||||
| time | Test execution time [ms] |
|
| time | Test execution time [ms] |
|
||||||
| url | Check run URL |
|
| url | Check run URL |
|
||||||
| url_html | Check run URL HTML |
|
| url_html | Check run URL HTML |
|
||||||
|
| slug_prefix| Random anchor links slug prefix generated for the summary headers |
|
||||||
|
|
||||||
## Supported formats
|
## Supported formats
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -88,10 +88,6 @@ inputs:
|
||||||
https://github.com/orgs/github/teams/engineering/discussions/871
|
https://github.com/orgs/github/teams/engineering/discussions/871
|
||||||
default: 'true'
|
default: 'true'
|
||||||
required: false
|
required: false
|
||||||
slug-prefix:
|
|
||||||
description: Prefix used when generating report anchor slugs
|
|
||||||
required: false
|
|
||||||
default: ''
|
|
||||||
badge-title:
|
badge-title:
|
||||||
description: Customize badge title
|
description: Customize badge title
|
||||||
required: false
|
required: false
|
||||||
|
|
@ -126,6 +122,8 @@ outputs:
|
||||||
description: Check run URL
|
description: Check run URL
|
||||||
url_html:
|
url_html:
|
||||||
description: Check run URL HTML
|
description: Check run URL HTML
|
||||||
|
slug_prefix:
|
||||||
|
description: Random prefix added to generated report anchor slugs for this action run
|
||||||
runs:
|
runs:
|
||||||
using: 'node20'
|
using: 'node20'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
|
|
|
||||||
6
dist/index.js
generated
vendored
6
dist/index.js
generated
vendored
|
|
@ -55383,6 +55383,8 @@ function getOctokit(token, options, ...additionalPlugins) {
|
||||||
return new GitHubWithPlugins(getOctokitOptions(token, options));
|
return new GitHubWithPlugins(getOctokitOptions(token, options));
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=github.js.map
|
//# sourceMappingURL=github.js.map
|
||||||
|
// EXTERNAL MODULE: external "node:crypto"
|
||||||
|
var external_node_crypto_ = __nccwpck_require__(7598);
|
||||||
// EXTERNAL MODULE: ./node_modules/adm-zip/adm-zip.js
|
// EXTERNAL MODULE: ./node_modules/adm-zip/adm-zip.js
|
||||||
var adm_zip = __nccwpck_require__(1316);
|
var adm_zip = __nccwpck_require__(1316);
|
||||||
// EXTERNAL MODULE: ./node_modules/picomatch/index.js
|
// EXTERNAL MODULE: ./node_modules/picomatch/index.js
|
||||||
|
|
@ -57864,6 +57866,7 @@ class NetteTesterJunitParser {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
try {
|
try {
|
||||||
|
|
@ -57891,7 +57894,7 @@ class TestReporter {
|
||||||
workDirInput = getInput('working-directory', { required: false });
|
workDirInput = getInput('working-directory', { required: false });
|
||||||
onlySummary = getInput('only-summary', { required: false }) === 'true';
|
onlySummary = getInput('only-summary', { required: false }) === 'true';
|
||||||
useActionsSummary = getInput('use-actions-summary', { required: false }) === 'true';
|
useActionsSummary = getInput('use-actions-summary', { required: false }) === 'true';
|
||||||
slugPrefix = getInput('slug-prefix', { required: false });
|
slugPrefix = `tr-${(0,external_node_crypto_.randomBytes)(4).toString('base64url')}-`;
|
||||||
badgeTitle = getInput('badge-title', { required: false });
|
badgeTitle = getInput('badge-title', { required: false });
|
||||||
reportTitle = getInput('report-title', { required: false });
|
reportTitle = getInput('report-title', { required: false });
|
||||||
collapsed = getInput('collapsed', { required: false });
|
collapsed = getInput('collapsed', { required: false });
|
||||||
|
|
@ -57965,6 +57968,7 @@ class TestReporter {
|
||||||
setOutput('failed', failed);
|
setOutput('failed', failed);
|
||||||
setOutput('skipped', skipped);
|
setOutput('skipped', skipped);
|
||||||
setOutput('time', time);
|
setOutput('time', time);
|
||||||
|
setOutput('slug_prefix', this.slugPrefix);
|
||||||
if (this.failOnError && isFailed) {
|
if (this.failOnError && isFailed) {
|
||||||
setFailed(`Failed test were found and 'fail-on-error' option is set to ${this.failOnError}`);
|
setFailed(`Failed test were found and 'fail-on-error' option is set to ${this.failOnError}`);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as github from '@actions/github'
|
import * as github from '@actions/github'
|
||||||
import {GitHub} from '@actions/github/lib/utils'
|
import {GitHub} from '@actions/github/lib/utils'
|
||||||
|
import {randomBytes} from 'node:crypto'
|
||||||
|
|
||||||
import {ArtifactProvider} from './input-providers/artifact-provider.js'
|
import {ArtifactProvider} from './input-providers/artifact-provider.js'
|
||||||
import {LocalFileProvider} from './input-providers/local-file-provider.js'
|
import {LocalFileProvider} from './input-providers/local-file-provider.js'
|
||||||
|
|
@ -49,7 +50,7 @@ class TestReporter {
|
||||||
readonly workDirInput = core.getInput('working-directory', {required: false})
|
readonly workDirInput = core.getInput('working-directory', {required: false})
|
||||||
readonly onlySummary = core.getInput('only-summary', {required: false}) === 'true'
|
readonly onlySummary = core.getInput('only-summary', {required: false}) === 'true'
|
||||||
readonly useActionsSummary = core.getInput('use-actions-summary', {required: false}) === 'true'
|
readonly useActionsSummary = core.getInput('use-actions-summary', {required: false}) === 'true'
|
||||||
readonly slugPrefix = core.getInput('slug-prefix', {required: false})
|
readonly slugPrefix = `tr-${randomBytes(4).toString('base64url')}-`
|
||||||
readonly badgeTitle = core.getInput('badge-title', {required: false})
|
readonly badgeTitle = core.getInput('badge-title', {required: false})
|
||||||
readonly reportTitle = core.getInput('report-title', {required: false})
|
readonly reportTitle = core.getInput('report-title', {required: false})
|
||||||
readonly collapsed = core.getInput('collapsed', {required: false}) as 'auto' | 'always' | 'never'
|
readonly collapsed = core.getInput('collapsed', {required: false}) as 'auto' | 'always' | 'never'
|
||||||
|
|
@ -145,6 +146,7 @@ class TestReporter {
|
||||||
core.setOutput('failed', failed)
|
core.setOutput('failed', failed)
|
||||||
core.setOutput('skipped', skipped)
|
core.setOutput('skipped', skipped)
|
||||||
core.setOutput('time', time)
|
core.setOutput('time', time)
|
||||||
|
core.setOutput('slug_prefix', this.slugPrefix)
|
||||||
|
|
||||||
if (this.failOnError && isFailed) {
|
if (this.failOnError && isFailed) {
|
||||||
core.setFailed(`Failed test were found and 'fail-on-error' option is set to ${this.failOnError}`)
|
core.setFailed(`Failed test were found and 'fail-on-error' option is set to ${this.failOnError}`)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue