scrape website #831
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: scrape website | |
on: | |
push: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 1 * * *" # every day at 1am (around 6am mauritian time) | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repo content | |
uses: actions/checkout@v3 | |
- name: setup python with pip cache | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
cache: "pip" # caching pip dependencies | |
- name: install any new python dependencies | |
run: | | |
cd backend | |
pip install -r requirements.txt | |
- name: execute py script | |
env: | |
SAK_MAIN_DB: ${{ secrets.SAK_MAIN_DB }} | |
SAK_STATS_DB: ${{ secrets.SAK_STATS_DB }} | |
run: python backend/src/main.py | |
- name: commit files | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add -A | |
timestamp=$(date -u) | |
git diff-index --quiet HEAD || (git commit -a -m "Last update : ${timestamp}" --allow-empty) | |
- name: push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main |