Skip to content

Commit 4ea676e

Browse files
committed
feat: Allow to ignore specific dependencies
1 parent eb9224f commit 4ea676e

File tree

14 files changed

+374
-163
lines changed

14 files changed

+374
-163
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
# slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
3535
# severity: low,medium
3636
# ecosystem: npm,rubygems
37+
# ignore_packages: lodash,devise
3738
# count: 20
3839
# pager_duty_integration_key: ${{ secrets.PAGER_DUTY_INTEGRATION_KEY }}
3940
# zenduty_api_key: ${{ secrets.ZENDUTY_API_KEY }}

action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ inputs:
4343
description: 'Comma separated list of severities. E.g. low,medium,high,critical (NO SPACES BETWEEN COMMA AND SEVERITY)'
4444
ecosystem:
4545
description: 'A comma-separated list of ecosystems. If specified, only alerts for these ecosystems will be returned.'
46+
ignore_packages:
47+
description: 'A comma-separated list of package names. If specified, alerts for these packages will be ignored.'
4648
branding:
4749
icon: 'alert-octagon'
4850
color: 'red'

dist/index.js

Lines changed: 191 additions & 72 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/alerts/enterprise.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { Octokit } from '@octokit/rest'
2+
3+
import { Alert, toEnterpriseAlert, PackageCveMap } from '../entities'
4+
5+
import { filterPackages } from './filters'
6+
7+
export const fetchEnterpriseAlerts = async (
8+
gitHubPersonalAccessToken: string,
9+
enterprise: string,
10+
severity: string,
11+
ecosystem: string,
12+
ignorePackages: PackageCveMap,
13+
count: number,
14+
): Promise<Alert[] | []> => {
15+
const octokit = new Octokit({
16+
auth: gitHubPersonalAccessToken,
17+
request: {
18+
fetch,
19+
},
20+
})
21+
const response = await octokit.dependabot.listAlertsForEnterprise({
22+
enterprise,
23+
state: 'open',
24+
severity,
25+
ecosystem: ecosystem.length > 0 ? ecosystem : undefined,
26+
per_page: count,
27+
})
28+
29+
return response.data
30+
.filter((dependabotAlert) =>
31+
filterPackages(dependabotAlert, ignorePackages),
32+
)
33+
.map(toEnterpriseAlert)
34+
}

0 commit comments

Comments
 (0)