Dependency Vulnerability Monitor #48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dependency Vulnerability Monitor | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Runs daily at midnight | |
workflow_dispatch: | |
jobs: | |
dependency-vulnerability-scan: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Run Dependency Vulnerability Scan | |
uses: dependabot/dependabot-core@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create issues for new vulnerabilities | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const { data: vulnerabilities } = await github.dependency_graph.getVulnerabilities({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}); | |
for (const vulnerability of vulnerabilities) { | |
await github.issues.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
title: `New vulnerability found: ${vulnerability.package_name}`, | |
body: `A new vulnerability has been found in the package ${vulnerability.package_name}.\n\nDetails:\n- Severity: ${vulnerability.severity}\n- Advisory: ${vulnerability.advisory}\n\nPlease address this vulnerability as soon as possible.`, | |
labels: ['security', 'vulnerability'], | |
}); | |
} |