fix linter/format
This commit is contained in:
@@ -60,7 +60,6 @@ test('it defaults to none severity', async () => {
|
|||||||
expect(config.fail_on_severity).toEqual('none')
|
expect(config.fail_on_severity).toEqual('none')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
test('it defaults to empty allow/deny lists ', async () => {
|
test('it defaults to empty allow/deny lists ', async () => {
|
||||||
const config = await readConfig()
|
const config = await readConfig()
|
||||||
|
|
||||||
|
|||||||
+9
-6
@@ -3,7 +3,7 @@ import * as dependencyGraph from './dependency-graph'
|
|||||||
import * as github from '@actions/github'
|
import * as github from '@actions/github'
|
||||||
import styles from 'ansi-styles'
|
import styles from 'ansi-styles'
|
||||||
import {RequestError} from '@octokit/request-error'
|
import {RequestError} from '@octokit/request-error'
|
||||||
import {Change, Severity, Changes, FailOnSeverity} from './schemas'
|
import {Change, Severity, Changes} from './schemas'
|
||||||
import {readConfig} from '../src/config'
|
import {readConfig} from '../src/config'
|
||||||
import {
|
import {
|
||||||
filterChangesBySeverity,
|
filterChangesBySeverity,
|
||||||
@@ -35,9 +35,9 @@ async function run(): Promise<void> {
|
|||||||
}
|
}
|
||||||
// config.fail_on_severity
|
// config.fail_on_severity
|
||||||
const failOnSeverityParams = config.fail_on_severity
|
const failOnSeverityParams = config.fail_on_severity
|
||||||
const failOnVulnerability = (config.fail_on_severity != 'none')
|
const failOnVulnerability = config.fail_on_severity !== 'none'
|
||||||
let minSeverity: Severity = 'low'
|
let minSeverity: Severity = 'low'
|
||||||
if (failOnSeverityParams != 'none') {
|
if (failOnSeverityParams !== 'none') {
|
||||||
minSeverity = failOnSeverityParams
|
minSeverity = failOnSeverityParams
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +73,11 @@ async function run(): Promise<void> {
|
|||||||
|
|
||||||
if (config.vulnerability_check) {
|
if (config.vulnerability_check) {
|
||||||
summary.addChangeVulnerabilitiesToSummary(vulnerableChanges, minSeverity)
|
summary.addChangeVulnerabilitiesToSummary(vulnerableChanges, minSeverity)
|
||||||
printVulnerabilitiesBlock(vulnerableChanges, minSeverity, failOnVulnerability)
|
printVulnerabilitiesBlock(
|
||||||
|
vulnerableChanges,
|
||||||
|
minSeverity,
|
||||||
|
failOnVulnerability
|
||||||
|
)
|
||||||
}
|
}
|
||||||
if (config.license_check) {
|
if (config.license_check) {
|
||||||
summary.addLicensesToSummary(invalidLicenseChanges, config)
|
summary.addLicensesToSummary(invalidLicenseChanges, config)
|
||||||
@@ -123,7 +127,6 @@ function printVulnerabilitiesBlock(
|
|||||||
if (vulFound) {
|
if (vulFound) {
|
||||||
const msg = 'Dependency review detected vulnerable packages.'
|
const msg = 'Dependency review detected vulnerable packages.'
|
||||||
if (failOnVulnerability) {
|
if (failOnVulnerability) {
|
||||||
const msg = 'Dependency review detected vulnerable packages.'
|
|
||||||
core.setFailed(msg)
|
core.setFailed(msg)
|
||||||
} else {
|
} else {
|
||||||
core.warning(msg)
|
core.warning(msg)
|
||||||
@@ -157,7 +160,7 @@ function printLicensesBlock(
|
|||||||
if (invalidLicenseChanges.forbidden.length > 0) {
|
if (invalidLicenseChanges.forbidden.length > 0) {
|
||||||
core.info('\nThe following dependencies have incompatible licenses:')
|
core.info('\nThe following dependencies have incompatible licenses:')
|
||||||
printLicensesError(invalidLicenseChanges.forbidden)
|
printLicensesError(invalidLicenseChanges.forbidden)
|
||||||
const msg = 'Dependency review detected incompatible licenses.';
|
const msg = 'Dependency review detected incompatible licenses.'
|
||||||
if (failOnVulnerability) {
|
if (failOnVulnerability) {
|
||||||
core.setFailed(msg)
|
core.setFailed(msg)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+7
-1
@@ -1,6 +1,12 @@
|
|||||||
import * as z from 'zod'
|
import * as z from 'zod'
|
||||||
|
|
||||||
export const FAIL_ON_SEVERITIES = ['critical', 'high', 'moderate', 'low', 'none'] as const
|
export const FAIL_ON_SEVERITIES = [
|
||||||
|
'critical',
|
||||||
|
'high',
|
||||||
|
'moderate',
|
||||||
|
'low',
|
||||||
|
'none'
|
||||||
|
] as const
|
||||||
export const SEVERITIES = ['critical', 'high', 'moderate', 'low'] as const
|
export const SEVERITIES = ['critical', 'high', 'moderate', 'low'] as const
|
||||||
export const SCOPES = ['unknown', 'runtime', 'development'] as const
|
export const SCOPES = ['unknown', 'runtime', 'development'] as const
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user