43 lines
1.2 KiB
YAML
43 lines
1.2 KiB
YAML
name: Update Data
|
|
on:
|
|
schedule:
|
|
- cron: '0 */6 * * *'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
update-data:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: nikolaik/python-nodejs:python3.12-nodejs22-slim
|
|
steps:
|
|
- name: Install system dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y git
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
|
|
- name: Run download script
|
|
run: python download_data.py
|
|
|
|
- name: Check for changes and commit
|
|
run: |
|
|
git config --global user.name 'Gitea Actions'
|
|
git config --global user.email 'actions@noreply.gitea.io'
|
|
|
|
# Check if new_data.json has changed
|
|
if [[ -n $(git status -s chrome-extension/new_data.json) ]]; then
|
|
echo "Changes detected in new_data.json"
|
|
git add chrome-extension/new_data.json
|
|
git commit -m "Auto-update new_data.json"
|
|
git push
|
|
else
|
|
echo "No changes detected"
|
|
fi
|