add new action-run-number to reporter

This commit is contained in:
Connor 2024-11-11 11:47:53 -06:00
parent ffc3bcb887
commit 09905229df
No known key found for this signature in database
GPG key ID: 455C6C81CB2BD091
3 changed files with 10 additions and 1 deletions

View file

@ -185,6 +185,9 @@ jobs:
# Defaults to false
show-html-notice: 'true'
# Allows for passing through calling actions run number and attempt. When running reruns, its hard to differentiate runs.
action-run-number: ''
# Personal access token used to interact with Github API
# Default: ${{ github.token }}
token: ''

View file

@ -69,6 +69,11 @@ inputs:
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'
action-run-number:
description: |
The run number of the action that generated the test results. Passed in through calling action into reporter
required: false
default: ''
only-summary:
description: |
Allows you to generate only the summary.

View file

@ -47,6 +47,7 @@ class TestReporter {
readonly workDirInput = core.getInput('working-directory', {required: false})
readonly onlySummary = core.getInput('only-summary', {required: false}) === 'true'
readonly showHTMLNotice = core.getInput('show-html-notice', {required: false}) === 'true'
readonly actionRunNumber = core.getInput('action-run-number', {required: false})
readonly token = core.getInput('token', {required: true})
readonly octokit: InstanceType<typeof GitHub>
readonly context = getCheckRunContext()
@ -226,7 +227,7 @@ class TestReporter {
core.info('*** showhtmlnotice set to true')
core.exportVariable('TEST_RESULTS_URL', `${resp.data.html_url}`)
core.info(`Set env var to: ${process.env.TEST_RESULTS_URL}`)
core.info(`::notice title=Test Results::${resp.data.html_url}`)
core.info(`::notice title=Test Results ${this.actionRunNumber}::${resp.data.html_url}`)
}
core.setOutput('url', resp.data.url)
core.setOutput('url_html', resp.data.html_url)