Skip to content

UpdateWebsite

UpdateWebsite #1169

name: UpdateWebsite
on:
workflow_dispatch:
schedule:
- cron: '0 4 * * *'
jobs:
build:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/cache@v2
name: Configure pip caching
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Python dependencies
run: |
python -m pip install -r ./.github/script/requirements.txt
- name: get trade data
env:
NEWS_API_KEY: ${{ secrets.NEWS_API_KEY }}
MARKET_TOKEN_KEY: ${{ secrets.MARKET_TOKEN_KEY }}
AF_URL: ${{ secrets.AF_URL }}
AF_TOKEN: ${{ secrets.AF_TOKEN }}
run: |-
python ./.github/script/build_trade-data.py
- name: Commit and push if data changed
run: |-
git config --global user.email "zmcx16-bot@zmcx16.moe"
git config --global user.name "zmcx16-bot"
git config --global pull.ff only
git pull
git diff
git diff --quiet || (git add *.json && git commit -m "Updated trade-data")
git push