filter allowed ghsas in action flow
This commit is contained in:
+14
-3
@@ -5,7 +5,11 @@ import styles from 'ansi-styles'
|
|||||||
import {RequestError} from '@octokit/request-error'
|
import {RequestError} from '@octokit/request-error'
|
||||||
import {Change, Severity, Scope} from './schemas'
|
import {Change, Severity, Scope} from './schemas'
|
||||||
import {readConfig} from '../src/config'
|
import {readConfig} from '../src/config'
|
||||||
import {filterChangesBySeverity, filterChangesByScopes} from '../src/filter'
|
import {
|
||||||
|
filterChangesBySeverity,
|
||||||
|
filterChangesByScopes,
|
||||||
|
filterOutAllowedAdvisories
|
||||||
|
} from '../src/filter'
|
||||||
import {getDeniedLicenseChanges} from './licenses'
|
import {getDeniedLicenseChanges} from './licenses'
|
||||||
import * as summary from './summary'
|
import * as summary from './summary'
|
||||||
import {getRefs} from './git-refs'
|
import {getRefs} from './git-refs'
|
||||||
@@ -34,9 +38,16 @@ async function run(): Promise<void> {
|
|||||||
|
|
||||||
const scopedChanges = filterChangesByScopes(scopes as Scope[], changes)
|
const scopedChanges = filterChangesByScopes(scopes as Scope[], changes)
|
||||||
|
|
||||||
|
const allowedGhsas: string[] = config.allow_ghsas || []
|
||||||
|
|
||||||
|
const filteredChanges = filterOutAllowedAdvisories(
|
||||||
|
allowedGhsas,
|
||||||
|
scopedChanges
|
||||||
|
)
|
||||||
|
|
||||||
const addedChanges = filterChangesBySeverity(
|
const addedChanges = filterChangesBySeverity(
|
||||||
minSeverity as Severity,
|
minSeverity as Severity,
|
||||||
scopedChanges
|
filteredChanges
|
||||||
).filter(
|
).filter(
|
||||||
change =>
|
change =>
|
||||||
change.change_type === 'added' &&
|
change.change_type === 'added' &&
|
||||||
@@ -45,7 +56,7 @@ async function run(): Promise<void> {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const [licenseErrors, unknownLicenses] = getDeniedLicenseChanges(
|
const [licenseErrors, unknownLicenses] = getDeniedLicenseChanges(
|
||||||
scopedChanges,
|
filteredChanges,
|
||||||
licenses
|
licenses
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user