-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Allow to ignore specific dependencies #196
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -43,6 +43,8 @@ inputs: | |||||
description: 'Comma separated list of severities. E.g. low,medium,high,critical (NO SPACES BETWEEN COMMA AND SEVERITY)' | ||||||
ecosystem: | ||||||
description: 'A comma-separated list of ecosystems. If specified, only alerts for these ecosystems will be returned.' | ||||||
ignore_dependencies: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
description: 'A comma-separated list of dependencies to ignore. If specified, these dependencies will not be alerted.' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
branding: | ||||||
icon: 'alert-octagon' | ||||||
color: 'red' | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -13,6 +13,7 @@ export const fetchRepositoryAlerts = async ( | |||||
repositoryOwner: string, | ||||||
severity: string, | ||||||
ecosystem: string, | ||||||
ignoreDependencies: string[], | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
count: number, | ||||||
): Promise<Alert[] | []> => { | ||||||
const octokit = new Octokit({ | ||||||
|
@@ -29,9 +30,14 @@ export const fetchRepositoryAlerts = async ( | |||||
ecosystem: ecosystem.length > 0 ? ecosystem : undefined, | ||||||
per_page: count, | ||||||
}) | ||||||
const alerts: Alert[] = response.data.map((dependabotAlert) => | ||||||
toRepositoryAlert(dependabotAlert, repositoryName, repositoryOwner), | ||||||
) | ||||||
const alerts: Alert[] = response | ||||||
.data | ||||||
.filter((dependabotAlert) => | ||||||
!ignoreDependencies.includes(dependabotAlert.security_vulnerability.package.name) | ||||||
) | ||||||
.map((dependabotAlert) => | ||||||
toRepositoryAlert(dependabotAlert, repositoryName, repositoryOwner), | ||||||
) | ||||||
Comment on lines
+33
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
return alerts | ||||||
} | ||||||
|
||||||
|
@@ -40,6 +46,7 @@ export const fetchOrgAlerts = async ( | |||||
org: string, | ||||||
severity: string, | ||||||
ecosystem: string, | ||||||
ignoreDependencies: string[], | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
count: number, | ||||||
): Promise<Alert[] | []> => { | ||||||
const octokit = new Octokit({ | ||||||
|
@@ -55,9 +62,14 @@ export const fetchOrgAlerts = async ( | |||||
ecosystem: ecosystem.length > 0 ? ecosystem : undefined, | ||||||
per_page: count, | ||||||
}) | ||||||
const alerts: Alert[] = response.data.map((dependabotOrgAlert) => | ||||||
toOrgAlert(dependabotOrgAlert), | ||||||
) | ||||||
const alerts: Alert[] = response | ||||||
.data | ||||||
.filter((dependabotOrgAlert) => | ||||||
!ignoreDependencies.includes(dependabotOrgAlert.security_vulnerability.package.name) | ||||||
) | ||||||
.map((dependabotOrgAlert) => | ||||||
toOrgAlert(dependabotOrgAlert), | ||||||
) | ||||||
Comment on lines
+65
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above |
||||||
return alerts | ||||||
} | ||||||
|
||||||
|
@@ -66,6 +78,7 @@ export const fetchEnterpriseAlerts = async ( | |||||
enterprise: string, | ||||||
severity: string, | ||||||
ecosystem: string, | ||||||
ignoreDependencies: string[], | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
count: number, | ||||||
): Promise<Alert[] | []> => { | ||||||
const octokit = new Octokit({ | ||||||
|
@@ -81,8 +94,13 @@ export const fetchEnterpriseAlerts = async ( | |||||
ecosystem: ecosystem.length > 0 ? ecosystem : undefined, | ||||||
per_page: count, | ||||||
}) | ||||||
const alerts: Alert[] = response.data.map((dependabotEnterpriseAlert) => | ||||||
toEnterpriseAlert(dependabotEnterpriseAlert), | ||||||
) | ||||||
const alerts: Alert[] = response | ||||||
.data | ||||||
.filter((dependabotEnterpriseAlert) => | ||||||
!ignoreDependencies.includes(dependabotEnterpriseAlert.security_vulnerability.package.name) | ||||||
) | ||||||
.map((dependabotEnterpriseAlert) => | ||||||
toEnterpriseAlert(dependabotEnterpriseAlert), | ||||||
) | ||||||
Comment on lines
+97
to
+104
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same comment as above |
||||||
return alerts | ||||||
} |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -39,16 +39,20 @@ async function run(): Promise<void> { | |||||
const count = parseInt(getInput('count')) | ||||||
const severity = getInput('severity') | ||||||
const ecosystem = getInput('ecosystem') | ||||||
const ignoreDependencies = ( | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
getInput('ignore_dependencies') || '' | ||||||
).split(',').map((str: string) => str.trim()) | ||||||
Comment on lines
+43
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's pass the value here directly using |
||||||
|
||||||
let alerts: Alert[] = [] | ||||||
if (org) { | ||||||
alerts = await fetchOrgAlerts(token, org, severity, ecosystem, count) | ||||||
alerts = await fetchOrgAlerts(token, org, severity, ecosystem, ignoreDependencies, count) | ||||||
} else if (enterprise) { | ||||||
alerts = await fetchEnterpriseAlerts( | ||||||
token, | ||||||
org, | ||||||
severity, | ||||||
ecosystem, | ||||||
ignoreDependencies, | ||||||
count, | ||||||
) | ||||||
} else { | ||||||
|
@@ -59,6 +63,7 @@ async function run(): Promise<void> { | |||||
owner, | ||||||
severity, | ||||||
ecosystem, | ||||||
ignoreDependencies, | ||||||
count, | ||||||
) | ||||||
} | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's call it
ignore_packages
since GitHub calls them packages instead of dependencies