Some checks failed
Test Action / Test with default inputs (ubuntu-latest, 4.11.1) (push) Successful in 17s
Test Action / Test with explicit inputs (ubuntu-latest, 4.11.1) (push) Successful in 19s
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (ubuntu-latest, 4.11.1, map[name:empty object value:{}]) (push) Successful in 18s
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (ubuntu-latest, 4.11.1, map[name:array value:- {}
- recursive: true
- args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Successful in 34s
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (ubuntu-latest, 4.11.1, map[name:global value:args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Successful in 23s
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (ubuntu-latest, 4.11.1, map[name:null value:null]) (push) Successful in 36s
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (ubuntu-latest, 4.11.1, map[name:recursive value:recursive: true
]) (push) Successful in 15s
Test Action / Test with default inputs (macos-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with default inputs (windows-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with explicit inputs (macos-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with explicit inputs (windows-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (macos-latest, 4.11.1, map[name:array value:- {}
- recursive: true
- args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (macos-latest, 4.11.1, map[name:empty object value:{}]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (macos-latest, 4.11.1, map[name:global value:args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (macos-latest, 4.11.1, map[name:null value:null]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (macos-latest, 4.11.1, map[name:recursive value:recursive: true
]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (windows-latest, 4.11.1, map[name:array value:- {}
- recursive: true
- args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (windows-latest, 4.11.1, map[name:empty object value:{}]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (windows-latest, 4.11.1, map[name:global value:args:
- --global
- --global-dir=./pnpm-global
- npm
- yarn
- pnpm
]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (windows-latest, 4.11.1, map[name:null value:null]) (push) Has been cancelled
Test Action / Test with run_install (${{ matrix.run_install.name }}, ${{ matrix.os }}) (windows-latest, 4.11.1, map[name:recursive value:recursive: true
]) (push) Has been cancelled
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { getInput, error, InputOptions } from '@actions/core'
|
|
import Ajv from 'ajv'
|
|
import { load } from 'js-yaml'
|
|
import process from 'process'
|
|
import runInstallSchema from './run-install-input.schema.json'
|
|
|
|
export interface RunInstall {
|
|
readonly recursive?: boolean
|
|
readonly cwd?: string
|
|
readonly args?: readonly string[]
|
|
}
|
|
|
|
export type RunInstallInput =
|
|
| null
|
|
| boolean
|
|
| RunInstall
|
|
| RunInstall[]
|
|
|
|
const options: InputOptions = {
|
|
required: true,
|
|
}
|
|
|
|
export function parseRunInstall(name: string): RunInstall[] {
|
|
const result: RunInstallInput = load(getInput(name, options)) as any
|
|
const ajv = new Ajv({
|
|
allErrors: true,
|
|
})
|
|
const validate = ajv.compile(runInstallSchema)
|
|
if (!validate(result)) {
|
|
for (const errorItem of validate.errors!) {
|
|
error(`with.run_install${errorItem.dataPath}: ${errorItem.message}`)
|
|
}
|
|
return process.exit(1)
|
|
}
|
|
if (!result) return []
|
|
if (result === true) return [{ recursive: true }]
|
|
if (Array.isArray(result)) return result
|
|
return [result]
|
|
}
|