Files
cve/.github/workflows/hot_cves.yml
T

140 lines
4.8 KiB
YAML

name: Hot CVEs List
# Fired every hour at :05 by pacemaker.yml. No cron here: GitHub's scheduler
# creates cron runs hours late, which is the whole reason the pacemaker exists.
on:
workflow_dispatch:
permissions:
contents: write
actions: write
concurrency:
group: repository-updates
queue: max
cancel-in-progress: false
jobs:
ScheduledRun:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v7
with:
ref: main
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.13'
- name: Publish saved candidates and refresh pending CVE metadata
id: pending
continue-on-error: true
run: python3 scripts/update_cves.py --pending-only
# Every repository pushed in the last day that names a CVE of this year
# or last, with its README read and the classifier applied, so a PoC
# published this morning is on the site within the hour. The daily run
# keeps covering every year and the CVE record references.
- name: Discover this year's PoCs pushed in the last day
id: discovery
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python3 scripts/update_cves.py --lookback-days 1 --years 2 --skip-cvelist
- name: Refresh repository metadata and remove confirmed dead links
id: repository_metadata
continue-on-error: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python3 scripts/sync_repo_metadata.py
- name: Rebuild the trending PoC table
id: trending
continue-on-error: true
# Leave time to publish discoveries if this optional refresh stalls.
timeout-minutes: 4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python3 .github/getTrending.py
- name: Ingest the current candidates
id: ingest
continue-on-error: true
if: steps.trending.outcome == 'success'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: python3 scripts/sync_pocingithub.py --input index/trending.json
- name: Record published artifact releases
run: python3 scripts/releases.py --record
- name: Redraw the banner and recount the index
run: |
# Counts the corpus with the site build's own parser, so the banner can
# never disagree with the site, and drops the figures in docs/stats.json
# for the README badges to quote.
python3 .github/hero.py
- name: Refresh README counts
run: python3 .github/getTrending.py --counts-only
- name: Check for changes and commit
id: commit
run: |
git config user.name 'CVE-BOT'
git config user.email '[email protected]'
git add --all -- \
README.md \
.github/repo_metadata_state.json \
index/link_health.json \
index/repo_meta.json \
index/metadata/ \
index/trending.json \
index/github.txt \
index/references.txt \
index/reference_pocs.txt \
index/cve_dates.json \
index/cve_record_state.json \
index/github_discovery_state.json \
index/source_artifact_reviews.json \
index/source_artifact_candidates.json \
docs/hero.svg \
docs/social-card.svg \
docs/stats.json \
docs/kev.svg \
index/releases/ \
cves/
if git diff --cached --quiet; then
echo "No changes to commit"
exit 0
fi
git commit -m "Trending CVEs update $(date -u +'%Y-%m-%d %H:%M') :robot:"
for attempt in 1 2 3; do
if git push origin HEAD:main; then
echo "pushed=true" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "Push rejected; replaying onto the current main (attempt $attempt)"
git fetch --unshallow origin main 2>/dev/null || git fetch origin main
git rebase FETCH_HEAD || { git rebase --abort; exit 1; }
done
exit 1
# Commits pushed with the workflow token raise no push event, so site.yml
# would otherwise wait for its daily schedule. Dispatching is exempt.
- name: Rebuild and deploy the site
if: steps.commit.outputs.pushed == 'true'
env:
GH_TOKEN: ${{ github.token }}
run: gh workflow run site.yml --ref main
- name: Report incomplete refresh
if: steps.pending.outcome == 'failure' || steps.discovery.outcome == 'failure' || steps.repository_metadata.outcome == 'failure' || steps.trending.outcome == 'failure' || steps.ingest.outcome == 'failure'
run: exit 1