Fetch CVE Details #294
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: Fetch CVE Details | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '45 20,6 * * *' | |
jobs: | |
fetch_cve_details: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' # Specify the version of Python you need | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
- name: Run CVE fetcher script | |
env: | |
API_KEY: ${{ secrets.VULNCHECK_API_KEY }} # Ensure your API key is stored in GitHub secrets | |
run: python build-cve-cache.py | |
- name: List contents of current directory | |
run: ls -la | |
- name: Commit and push if changes are detected | |
run: | | |
# Get the current timestamp | |
timestamp=$(date +'%Y-%m-%d %H:%M:%S') | |
# Configure git user for committing | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
# Stage the modified cve_details.json file for commit | |
git add cache/cve_details.json | |
# Commit changes with a timestamp, exit if no changes to commit | |
git commit -m "Update CVE details - $timestamp" -a || exit 0 | |
# Push the changes to the remote repository | |
git push |