Files

33 lines
904 B
TypeScript
Raw Permalink Normal View History

2023-04-06 17:32:42 +02:00
// GitHub Action inputs come in the form of environment variables
// with an INPUT prefix (e.g. INPUT_FAIL-ON-SEVERITY)
export function setInput(input: string, value: string): void {
process.env[`INPUT_${input.toUpperCase()}`] = value
}
// We want a clean ENV before each test. We use `delete`
// since we want `undefined` values and not empty strings.
export function clearInputs(): void {
const allowedOptions = [
'FAIL-ON-SEVERITY',
'FAIL-ON-SCOPES',
'ALLOW-LICENSES',
'ALLOW-DEPENDENCIES-LICENSES',
2023-04-06 17:32:42 +02:00
'DENY-LICENSES',
'ALLOW-GHSAS',
'LICENSE-CHECK',
'VULNERABILITY-CHECK',
'CONFIG-FILE',
'BASE-REF',
'HEAD-REF',
2023-06-14 09:12:19 +02:00
'COMMENT-SUMMARY-IN-PR',
2024-04-27 22:10:57 +00:00
'WARN-ONLY',
'DENY-GROUPS',
'DENY-PACKAGES'
2023-04-06 17:32:42 +02:00
]
// eslint-disable-next-line github/array-foreach
allowedOptions.forEach(option => {
delete process.env[`INPUT_${option.toUpperCase()}`]
})
}