-
Notifications
You must be signed in to change notification settings - Fork 19
/
options.ts
34 lines (27 loc) · 1.1 KB
/
options.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import * as core from '@actions/core';
import { getCoverageModeFrom } from './FileCoverageMode';
import * as path from 'node:path';
import { getViteConfigPath } from './getViteConfigPath';
import { parseCoverageThresholds } from './parseCoverageThresholds';
async function readOptions() {
// Working directory can be used to modify all default/provided paths (for monorepos, etc)
const workingDirectory = core.getInput('working-directory');
const fileCoverageModeRaw = core.getInput('file-coverage-mode'); // all/changes/none
const fileCoverageMode = getCoverageModeFrom(fileCoverageModeRaw);
const jsonSummaryPath = path.resolve(workingDirectory, core.getInput('json-summary-path'));
const viteConfigPath = await getViteConfigPath(workingDirectory, core.getInput("vite-config-path"));
const thresholds = await parseCoverageThresholds(viteConfigPath);
const jsonFinalPath = path.resolve(workingDirectory, core.getInput('json-final-path'));
const name = core.getInput('name');
return {
fileCoverageMode,
jsonFinalPath,
jsonSummaryPath,
name,
thresholds,
workingDirectory
}
}
export {
readOptions
}