Update plots #322
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: Update plots | |
on: | |
schedule: | |
- cron: "42 0 * * *" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
plots: | |
name: PPoS Dex Plots | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11.3 | |
- name: Set up Poetry | |
uses: abatilo/[email protected] | |
with: | |
poetry-version: 1.6.1 | |
- name: Install Python dependencies | |
run: poetry install | |
- name: Checkout local images branch | |
run: git checkout -b images | |
- name: Save timeseries | |
run: poetry run python3 ppos_dex.py timeseries --save | |
- name: Save snapshots | |
run: poetry run python3 ppos_dex.py snapshot --save | |
- name: Delete remote images branch | |
run: git push origin -d images | |
continue-on-error: true | |
- name: Commit files | |
id: commit_files | |
if: always() | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "github-actions[bot]" | |
if [ -n "$(git status --porcelain)" ]; then | |
git commit -m "refreshed images 🤖" -a | |
echo "HAS_COMMITS=true" >> "$GITHUB_ENV" | |
else | |
echo "no changes - skipping " | |
echo "HAS_COMMITS=false" >> "$GITHUB_ENV" | |
fi | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
if: env.HAS_COMMITS != false | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: images |