Skip to content

Commit

Permalink
filter allowed ghsas in action flow
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahkemi committed Sep 22, 2022
1 parent 602f968 commit 4f00b72
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import styles from 'ansi-styles'
import {RequestError} from '@octokit/request-error'
import {Change, Severity, Scope} from './schemas'
import {readConfig} from '../src/config'
import {filterChangesBySeverity, filterChangesByScopes} from '../src/filter'
import {
filterChangesBySeverity,
filterChangesByScopes,
filterOutAllowedAdvisories
} from '../src/filter'
import {getDeniedLicenseChanges} from './licenses'
import * as summary from './summary'
import {getRefs} from './git-refs'
Expand Down Expand Up @@ -34,9 +38,16 @@ async function run(): Promise<void> {

const scopedChanges = filterChangesByScopes(scopes as Scope[], changes)

const allowedGhsas: string[] = config.allow_ghsas || []

const filteredChanges = filterOutAllowedAdvisories(
allowedGhsas,
scopedChanges
)

const addedChanges = filterChangesBySeverity(
minSeverity as Severity,
scopedChanges
filteredChanges
).filter(
change =>
change.change_type === 'added' &&
Expand All @@ -45,7 +56,7 @@ async function run(): Promise<void> {
)

const [licenseErrors, unknownLicenses] = getDeniedLicenseChanges(
scopedChanges,
filteredChanges,
licenses
)

Expand Down

0 comments on commit 4f00b72

Please sign in to comment.