Add license-check and vulnerability-check inputs

Add support for two new inputs, named `license-check` and
`vulnerability-check`, to disable the license checks or vulnerability
checks performed by this action. By default, both are enabled.
This commit is contained in:
Eric Cornelissen
2022-10-28 21:59:30 +02:00
parent 2532504548
commit 31279d265a
4 changed files with 61 additions and 5 deletions

View File

@@ -13,6 +13,11 @@ import {isSPDXValid} from './utils'
type licenseKey = 'allow-licenses' | 'deny-licenses'
function getOptionalBoolean(name: string): boolean | undefined {
const value = core.getInput(name)
return value.length > 0 ? core.getBooleanInput(name) : undefined
}
function getOptionalInput(name: string): string | undefined {
const value = core.getInput(name)
return value.length > 0 ? value : undefined
@@ -77,6 +82,15 @@ export function readInlineConfig(): ConfigurationOptions {
const allow_ghsas = parseList(getOptionalInput('allow-ghsas'))
const license_check = z
.boolean()
.default(true)
.parse(getOptionalBoolean('license-check'))
const vulnerability_check = z
.boolean()
.default(true)
.parse(getOptionalBoolean('vulnerability-check'))
const base_ref = getOptionalInput('base-ref')
const head_ref = getOptionalInput('head-ref')
@@ -86,6 +100,8 @@ export function readInlineConfig(): ConfigurationOptions {
allow_licenses,
deny_licenses,
allow_ghsas,
license_check,
vulnerability_check,
base_ref,
head_ref
}