34 lines
987 B
YAML
34 lines
987 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 https://snoop.owenqwen.com/latest/txt
|
|
|
|
- name: Fetch JSON data
|
|
run: |
|
|
curl -o data/data.json https://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)
|