run script index.py #1533
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: run script index.py | |
on: | |
schedule: | |
- cron: '10 */4 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout repo content | |
uses: actions/checkout@v2 | |
- name: setup python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: install python packages | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: execute py script # run index.py | |
env: | |
TOFFEE_SECRET_KEY: ${{ secrets.TOFFEE_SECRET_KEY }} | |
TOFFEE_HEADER1: ${{ secrets.TOFFEE_HEADER1 }} | |
TOFFEE_HEADER2: ${{ secrets.TOFFEE_HEADER2 }} | |
BDPROXY: ${{ secrets.BDPROXY }} | |
TOFFEE_URL1: ${{ secrets.TOFFEE_URL1 }} | |
TOFFEE_URL2: ${{ secrets.TOFFEE_URL2 }} | |
run: python api/index.py | |
- name: commit files | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add -A | |
git diff-index --quiet HEAD || (git commit -a -m "Toffee Data updated!" --allow-empty) | |
- name: push changes | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: main | |
permissions: | |
contents: write |