Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Commit 7f711b0

Browse files
committed
Add filter by ecosystem (rubygems, npm, etc.)
1 parent 3787d95 commit 7f711b0

File tree

7 files changed

+19
-4
lines changed

7 files changed

+19
-4
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ jobs:
3131
# microsoft_teams_webhook: ${{ secrets.MICROSOFT_TEAMS_WEBHOOK }}
3232
# slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
3333
# severity: low,medium
34+
# ecosystem: npm,rubygems
3435
# count: 20
3536
# pager_duty_integration_key: ${{ secrets.PAGER_DUTY_INTEGRATION_KEY }}
3637
# zenduty_api_key: ${{ secrets.ZENDUTY_API_KEY }}

.yarn/install-state.gz

24.6 KB
Binary file not shown.

action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ inputs:
3737
default: 20
3838
severity:
3939
description: 'Comma separated list of severities. E.g. low,medium,high,critical (NO SPACES BETWEEN COMMA AND SEVERITY)'
40+
ecosystem:
41+
description: "A comma-separated list of ecosystems. If specified, only alerts for these ecosystems will be returned."
4042
branding:
4143
icon: 'alert-octagon'
4244
color: 'red'

dist/index.js

Lines changed: 4 additions & 2 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/fetch-alerts.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export const fetchAlerts = async (
77
repositoryName: string,
88
repositoryOwner: string,
99
severity: string,
10+
ecosystem: string,
1011
count: number,
1112
): Promise<Alert[] | []> => {
1213
const octokit = new Octokit({
@@ -20,6 +21,7 @@ export const fetchAlerts = async (
2021
repo: repositoryName,
2122
state: 'open',
2223
severity,
24+
ecosystem,
2325
per_page: count,
2426
})
2527
const alerts: Alert[] = response.data.map((dependabotAlert) =>

src/main.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,17 @@ async function run(): Promise<void> {
3131
const emailTransportSmtpPassword = getInput('email_transport_smtp_password')
3232
const count = parseInt(getInput('count'))
3333
const severity = getInput('severity')
34+
const ecosystem = getInput('ecosystem')
3435
const { owner } = context.repo
3536
const { repo } = context.repo
36-
const alerts = await fetchAlerts(token, repo, owner, severity, count)
37+
const alerts = await fetchAlerts(
38+
token,
39+
repo,
40+
owner,
41+
severity,
42+
ecosystem,
43+
count,
44+
)
3745
if (alerts.length > 0) {
3846
if (microsoftTeamsWebhookUrl) {
3947
await sendAlertsToMicrosoftTeams(microsoftTeamsWebhookUrl, alerts)

0 commit comments

Comments
 (0)