Add logic for denied licenses.

This commit is contained in:
Federico Builes
2022-06-06 20:32:46 +02:00
parent 1261e18905
commit 2ae9a2d51b
2 changed files with 29 additions and 12 deletions
+8 -4
View File
@@ -1,4 +1,3 @@
import * as core from '@actions/core'
import {Change, ChangeSchema} from './schemas'
export function hasInvalidLicenses(
@@ -21,9 +20,14 @@ export function hasInvalidLicenses(
if (license === null) {
continue
}
if (!allowLicenses.includes(license)) {
disallowed.push(change)
if (allowLicenses.length > 0) {
if (!allowLicenses.includes(license)) {
disallowed.push(change)
}
} else if (failLicenses.length > 0) {
if (failLicenses.includes(license)) {
disallowed.push(change)
}
}
}