Skip to content

Instantly share code, notes, and snippets.

@han-s-kl
Created February 5, 2026 00:10
Show Gist options
  • Select an option

  • Save han-s-kl/5fb1582ca764782da2595e66219ab94e to your computer and use it in GitHub Desktop.

Select an option

Save han-s-kl/5fb1582ca764782da2595e66219ab94e to your computer and use it in GitHub Desktop.
name: Data Cache Update
on:
schedule:
- cron: "0 * * * *"
workflow_dispatch:
permissions:
contents: write
jobs:
update-cache:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: pip install -r scripts/requirements.txt
- name: Determine mode
id: mode
run: |
HOUR=$(date -u +%H)
if [ "$HOUR" = "05" ]; then
echo "mode=daily" >> $GITHUB_OUTPUT
else
echo "mode=frequent" >> $GITHUB_OUTPUT
fi
- name: Run cache generator
env:
FIREBASE_CREDENTIALS: ${{ secrets.FIREBASE_CREDENTIALS }}
run: python scripts/fetch_all_data.py ${{ steps.mode.outputs.mode }}
- name: Push to cache repo
env:
CACHE_TOKEN: ${{ secrets.CACHE_TOKEN }}
run: |
cd cache
git init
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git remote add origin "https://x-access-token:${CACHE_TOKEN}@github.com/han-s-kl/aurora-cache.git"
git add -A
git commit -m "Update cache" || echo "No changes"
git branch -M main
git push --force origin main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment