Skeleton for license validation.
This commit is contained in:
+12
@@ -6,6 +6,7 @@ import {RequestError} from '@octokit/request-error'
|
||||
import {Change, PullRequestSchema, Severity} from './schemas'
|
||||
import {readConfigFile} from '../src/config'
|
||||
import {filterChangesBySeverity} from '../src/filter'
|
||||
import {hasInvalidLicenses, printLicensesError} from './licenses'
|
||||
|
||||
async function run(): Promise<void> {
|
||||
try {
|
||||
@@ -35,6 +36,17 @@ async function run(): Promise<void> {
|
||||
changes
|
||||
)
|
||||
|
||||
let licenseErrors = hasInvalidLicenses(
|
||||
changes,
|
||||
config.allow_licenses,
|
||||
config.deny_licenses
|
||||
)
|
||||
|
||||
if (licenseErrors.length > 0) {
|
||||
printLicensesError(licenseErrors)
|
||||
throw new Error('Dependency review detected incompatible licenses.')
|
||||
}
|
||||
|
||||
for (const change of filteredChanges) {
|
||||
if (
|
||||
change.change_type === 'added' &&
|
||||
|
||||
Reference in New Issue
Block a user