test: directory mapping

This commit is contained in:
Martin Fillafer 2023-03-20 15:29:56 +01:00
parent 3606ee2f36
commit 8cb6ade3ac
3 changed files with 10 additions and 0 deletions

View file

@ -18,3 +18,5 @@ jobs:
name: Workflow Report name: Workflow Report
path: '*.xml' path: '*.xml'
reporter: jest-junit reporter: jest-junit
directory-mapping:
from/path: to/something/else

View file

@ -68,6 +68,11 @@ inputs:
Detailed listing of test suites and test cases will be skipped. Detailed listing of test suites and test cases will be skipped.
default: 'false' default: 'false'
required: false required: false
directory-mapping:
description: |
Map part of the file paths to something else, so they match the paths of the repository.
This is needed when you use run your code in a container with a different path than the source code repository.
required: false
token: token:
description: GitHub Access Token description: GitHub Access Token
required: false required: false

View file

@ -44,6 +44,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 token = core.getInput('token', {required: true}) readonly token = core.getInput('token', {required: true})
readonly directoryMapping = core.getInput('directory-mapping', {required: true})
readonly octokit: InstanceType<typeof GitHub> readonly octokit: InstanceType<typeof GitHub>
readonly context = getCheckRunContext() readonly context = getCheckRunContext()
@ -64,6 +65,8 @@ class TestReporter {
core.setFailed(`Input parameter 'max-annotations' has invalid value`) core.setFailed(`Input parameter 'max-annotations' has invalid value`)
return return
} }
console.log('Directory mapping: ', this.directoryMapping)
} }
async run(): Promise<void> { async run(): Promise<void> {