Daily Data Fetch #126
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Daily Data Fetch | |
on: | |
workflow_dispatch: | |
schedule: | |
# Runs at 12:00 UTC every day | |
- cron: "0 12 * * *" | |
jobs: | |
fetch_and_process_data: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests SPARQLWrapper pandas | |
- name: Run data fetch script | |
run: python scripts/fetch_wikipedia_data.py | |
- name: Update timestamp in index.html | |
run: | | |
today=$(date -u +"%Y-%m-%d") | |
sed -i "s|<footer>.*</footer>|<footer>Data last updated: $today</footer>|g" index.html | |
- name: Commit and push changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add data/*.csv index.html | |
git commit -m "Update data and timestamp" | |
git push | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: . # Assuming index.html and data are in the root directory |