Files
snoopllama-list/.github/workflows/fetch-data.yml
T

34 lines
985 B
YAML

name: Fetch Data Hourly
on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:
jobs:
fetch-and-commit:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create data directory
run: mkdir -p data
- name: Fetch TXT data
run: |
curl -o data/data.txt http://snoop.owenqwen.com/latest/txt
- name: Fetch JSON data
run: |
curl -o data/data.json http://snoop.owenqwen.com/latest/json
- name: Commit and push if changed
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add data/data.txt data/data.json
git diff --quiet && git diff --staged --quiet || (git commit -m "Update data: $(date -u +'%Y-%m-%d %H:%M:%S UTC')" && git push)