53 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| name: Generate banlist history graph
 | |
| 
 | |
| on:
 | |
|   push:
 | |
|     branches: [ main ]
 | |
|     paths:
 | |
|       - 'banned.txt'
 | |
|       - 'scripts/banlist_metrics.py'
 | |
|       - '.github/workflows/generate-banlist-graph.yml'
 | |
|   schedule:
 | |
|     - cron: '17 3 * * *'
 | |
|   workflow_dispatch: {}
 | |
| 
 | |
| jobs:
 | |
|   build:
 | |
|     runs-on: ubuntu-latest
 | |
|     permissions:
 | |
|       contents: write
 | |
|     steps:
 | |
|       - name: Checkout
 | |
|         uses: actions/checkout@v4
 | |
|         with:
 | |
|           fetch-depth: 0
 | |
| 
 | |
|       - name: Set up Python
 | |
|         uses: actions/setup-python@v5
 | |
|         with:
 | |
|           python-version: '3.x'
 | |
| 
 | |
|       - name: Install dependencies
 | |
|         run: |
 | |
|           python -m pip install --upgrade pip
 | |
|           pip install matplotlib
 | |
| 
 | |
|       - name: Generate metrics and chart
 | |
|         run: |
 | |
|           python scripts/banlist_metrics.py \
 | |
|             --file banned.txt \
 | |
|             --csv metrics/banlist_counts.csv \
 | |
|             --image assets/banlist_history.svg
 | |
| 
 | |
|       - name: Commit changes (if any)
 | |
|         run: |
 | |
|           git config user.name "actions-bot"
 | |
|           git config user.email "actions@users.noreply.github.com"
 | |
|           if [ -n "$(git status --porcelain -- metrics assets)" ]; then
 | |
|             git add metrics assets
 | |
|             git commit -m "chore: update banlist history graph [skip ci]"
 | |
|             git push
 | |
|           else
 | |
|             echo "No changes to commit."
 | |
|           fi
 | |
| 
 |