Add GitHub Actions workflow for auto-updates
This commit is contained in:
62
.github/workflows/update-metrics.yml
vendored
Normal file
62
.github/workflows/update-metrics.yml
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
name: Update Metrics
|
||||
|
||||
on:
|
||||
schedule:
|
||||
# Run every hour
|
||||
- cron: '0 * * * *'
|
||||
workflow_dispatch: # Allow manual trigger
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'scripts/**'
|
||||
|
||||
jobs:
|
||||
update-metrics:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install requests PyGithub pyyaml anthropic
|
||||
|
||||
- name: Update infrastructure metrics
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
RAILWAY_API_TOKEN: ${{ secrets.RAILWAY_API_TOKEN }}
|
||||
run: |
|
||||
python scripts/update_infrastructure.py
|
||||
|
||||
- name: Update repository metrics
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
python scripts/update_repositories.py
|
||||
|
||||
- name: Update code metrics
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
python scripts/update_code_metrics.py
|
||||
|
||||
- name: Update resume data
|
||||
run: |
|
||||
python scripts/update_resume_data.py
|
||||
|
||||
- name: Commit and push changes
|
||||
run: |
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git add -A
|
||||
git diff --quiet && git diff --staged --quiet || (git commit -m "🤖 Auto-update metrics $(date -u +%Y-%m-%dT%H:%M:%SZ)" && git push)
|
||||
Reference in New Issue
Block a user