feat: render the AbuseIPDB report count from public/abuseipdb.json
infra-monitor pushes the count; a push to the file now triggers the workflow, which shows it rounded down to the thousand. Falls back to the previous figure until the file is first published. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e4dc0f91d3
commit
4594cad5e5
2 files changed
+17
-2
No files matched your search
@@ -4,6 +4,7 @@ on:
|
||||
paths:
|
||||
- 'public/code-stats.json'
|
||||
- 'public/heatmap.json'
|
||||
- 'public/abuseipdb.json'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@@ -50,10 +51,24 @@ jobs:
|
||||
|
||||
echo "FORMATTED_LOC=$FORMATTED_LOC" >> "$GITHUB_ENV"
|
||||
|
||||
# Pushed by infra-monitor's push_profile_stats.py. Shown rounded down to
|
||||
# the thousand ("31,000+"); falls back to the last hand-written figure
|
||||
# if the file hasn't been published yet.
|
||||
ABUSE_FILE="public/abuseipdb.json"
|
||||
if [ -f "$ABUSE_FILE" ]; then
|
||||
ABUSE_REPORTS=$(jq -er '.total_reports' "$ABUSE_FILE")
|
||||
FORMATTED_ABUSE=$(python3 -c \
|
||||
'import sys; n=int(sys.argv[1]); print(f"{n // 1000 * 1000:,}+")' "$ABUSE_REPORTS")
|
||||
else
|
||||
FORMATTED_ABUSE="30,000+"
|
||||
fi
|
||||
echo "AbuseIPDB reports: $FORMATTED_ABUSE"
|
||||
|
||||
python3 scripts/generate_heatmap_svg.py public/heatmap.json public/heatmap.svg
|
||||
|
||||
sed "s/REPLACE_ME_LOC/$FORMATTED_LOC/g" README.template | \
|
||||
sed "s/REPLACE_ME_COMMITS/$TOTAL_COMMITS/g" > README.md
|
||||
sed "s/REPLACE_ME_COMMITS/$TOTAL_COMMITS/g" | \
|
||||
sed "s/REPLACE_ME_ABUSE/$FORMATTED_ABUSE/g" > README.md
|
||||
|
||||
- name: Commit and Push
|
||||
run: |
|
||||
|
||||
Reference in new issue
Block a user