add new show-html-notice input

This commit is contained in:
Connor Vidlock 2023-03-20 09:42:33 -05:00
parent e9fa2f582c
commit f354bfa69d
No known key found for this signature in database
GPG key ID: BADEF4A267C14600
3 changed files with 10 additions and 0 deletions

View file

@ -27,3 +27,4 @@ jobs:
with: with:
name: test-results name: test-results
path: __tests__/__results__/*.xml path: __tests__/__results__/*.xml
show-html-notice: true

View file

@ -60,6 +60,10 @@ inputs:
working-directory: working-directory:
description: Relative path under $GITHUB_WORKSPACE where the repository was checked out description: Relative path under $GITHUB_WORKSPACE where the repository was checked out
required: false required: false
show-html-notice:
description: Show the link to the html results in the form of a notice on the summary page. This was created to combat a GHA bug of not always displaying the results in the right action.
required: false
default: 'false'
only-summary: only-summary:
description: | description: |
Allows you to generate only the summary. Allows you to generate only the summary.

View file

@ -42,6 +42,7 @@ class TestReporter {
readonly failOnError = core.getInput('fail-on-error', {required: true}) === 'true' readonly failOnError = core.getInput('fail-on-error', {required: true}) === 'true'
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 showHTMLNotice = core.getInput('show-html-notice', {required:false}) === 'true'
readonly token = core.getInput('token', {required: true}) readonly token = core.getInput('token', {required: true})
readonly octokit: InstanceType<typeof GitHub> readonly octokit: InstanceType<typeof GitHub>
readonly context = getCheckRunContext() readonly context = getCheckRunContext()
@ -198,6 +199,10 @@ class TestReporter {
core.info(`Check run create response: ${resp.status}`) core.info(`Check run create response: ${resp.status}`)
core.info(`Check run URL: ${resp.data.url}`) core.info(`Check run URL: ${resp.data.url}`)
core.info(`Check run HTML: ${resp.data.html_url}`) core.info(`Check run HTML: ${resp.data.html_url}`)
if (this.showHTMLNotice) {
console.log(`::notice title=Test Results::${resp.data.html_url}`)
}
return results return results
} }