2023-07-26 18:50:04 +07:00
|
|
|
import { getBooleanInput, getInput, InputOptions } from '@actions/core'
|
2020-05-08 14:24:25 +07:00
|
|
|
import expandTilde from 'expand-tilde'
|
2020-05-09 20:01:25 +07:00
|
|
|
import { RunInstall, parseRunInstall } from './run-install'
|
2020-05-08 11:29:39 +07:00
|
|
|
|
|
|
|
export interface Inputs {
|
2022-02-22 12:26:05 +08:00
|
|
|
readonly version?: string
|
2020-05-08 11:29:39 +07:00
|
|
|
readonly dest: string
|
2020-05-09 19:13:46 +07:00
|
|
|
readonly runInstall: RunInstall[]
|
2023-07-08 07:02:46 +08:00
|
|
|
readonly packageJsonFile: string
|
2023-07-26 18:50:04 +07:00
|
|
|
readonly standalone: boolean
|
2020-05-08 11:29:39 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
const options: InputOptions = {
|
|
|
|
required: true,
|
|
|
|
}
|
|
|
|
|
2020-05-08 14:24:25 +07:00
|
|
|
const parseInputPath = (name: string) => expandTilde(getInput(name, options))
|
2020-05-08 14:12:16 +07:00
|
|
|
|
2020-05-08 14:24:25 +07:00
|
|
|
export const getInputs = (): Inputs => ({
|
2022-02-22 12:26:05 +08:00
|
|
|
version: getInput('version'),
|
2020-05-08 14:24:25 +07:00
|
|
|
dest: parseInputPath('dest'),
|
2020-05-09 19:13:46 +07:00
|
|
|
runInstall: parseRunInstall('run_install'),
|
2023-07-08 07:02:46 +08:00
|
|
|
packageJsonFile: parseInputPath('package_json_file'),
|
2023-07-26 18:50:04 +07:00
|
|
|
standalone: getBooleanInput('standalone'),
|
2020-05-08 11:29:39 +07:00
|
|
|
})
|
|
|
|
|
|
|
|
export default getInputs
|