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

Commit

Permalink
Add filter by ecosystem (rubygems, npm, etc.)
Browse files Browse the repository at this point in the history
  • Loading branch information
rndev15 committed May 27, 2024
1 parent 3787d95 commit 7f711b0
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
# microsoft_teams_webhook: ${{ secrets.MICROSOFT_TEAMS_WEBHOOK }}
# slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
# severity: low,medium
# ecosystem: npm,rubygems
# count: 20
# pager_duty_integration_key: ${{ secrets.PAGER_DUTY_INTEGRATION_KEY }}
# zenduty_api_key: ${{ secrets.ZENDUTY_API_KEY }}
Expand Down
Binary file modified .yarn/install-state.gz
Binary file not shown.
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ inputs:
default: 20
severity:
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."
branding:
icon: 'alert-octagon'
color: 'red'
Expand Down
6 changes: 4 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/fetch-alerts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const fetchAlerts = async (
repositoryName: string,
repositoryOwner: string,
severity: string,
ecosystem: string,
count: number,
): Promise<Alert[] | []> => {
const octokit = new Octokit({
Expand All @@ -20,6 +21,7 @@ export const fetchAlerts = async (
repo: repositoryName,
state: 'open',
severity,
ecosystem,
per_page: count,
})
const alerts: Alert[] = response.data.map((dependabotAlert) =>
Expand Down
10 changes: 9 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,17 @@ async function run(): Promise<void> {
const emailTransportSmtpPassword = getInput('email_transport_smtp_password')
const count = parseInt(getInput('count'))
const severity = getInput('severity')
const ecosystem = getInput('ecosystem')
const { owner } = context.repo
const { repo } = context.repo
const alerts = await fetchAlerts(token, repo, owner, severity, count)
const alerts = await fetchAlerts(
token,
repo,
owner,
severity,
ecosystem,
count,
)
if (alerts.length > 0) {
if (microsoftTeamsWebhookUrl) {
await sendAlertsToMicrosoftTeams(microsoftTeamsWebhookUrl, alerts)
Expand Down

0 comments on commit 7f711b0

Please sign in to comment.