Daily Price Updates #22
This file contains hidden or 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 Price Updates | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Run at midnight UTC daily | |
workflow_dispatch: # Allow manual trigger | |
jobs: | |
update-prices: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -e ".[dev]" | |
- name: Update prices | |
run: python update_prices.py | |
- name: Check for changes | |
id: git-check | |
run: | | |
git status --porcelain | |
echo "changed=$(git status --porcelain | wc -l)" >> $GITHUB_OUTPUT | |
- name: Get current date | |
id: date | |
run: echo "date=$(date +'%d-%m-%Y')" >> $GITHUB_OUTPUT | |
- name: Show status | |
run: | | |
if [ "${{ steps.git-check.outputs.changed }}" -gt "0" ]; then | |
echo "Changes detected - will create PR" | |
git status | |
else | |
echo "No changes detected - skipping PR creation" | |
fi | |
- name: Create Pull Request | |
if: steps.git-check.outputs.changed > 0 | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
commit-message: "chore: Update token prices (${{ steps.date.outputs.date }})" | |
title: "chore: Daily token price update (${{ steps.date.outputs.date }})" | |
body: | | |
GitHub Action to update token prices | |
This PR updates the token prices based on the latest data. | |
Changes detected: | |
``` | |
${{ steps.git-check.outputs.changed }} files modified | |
``` | |
branch: automated/price-updates-${{ steps.date.outputs.date }} | |
base: main | |
delete-branch: true | |
draft: false | |
reviewers: | | |
the-praxs | |
labels: | | |
automated | |
prices |