Skip to content

Update GitHub Data

Update GitHub Data #84

Workflow file for this run

name: Update GitHub Data
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
push:
branches: [ main ]
# ADD THIS BLOCK HERE
permissions:
contents: write
jobs:
update-json:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Set up Python 3.14
uses: actions/setup-python@v5
with:
python-version: '3.14-dev'
- name: Fetch Data
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
uv run --with requests update_data.py
- name: Commit and Push
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# Stage the file
git add data.json
# Only commit if there are actual changes
if git diff --staged --quiet; then
echo "No changes to data.json, skipping push."
else
git commit -m "chore: update data.json"
# Rebase pulls the remote changes and puts your new commit on top
# This prevents the "divergent branches" error
git pull --rebase origin main
git push origin main
fi