Update Pricing Data #136
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: Update Pricing Data | |
| on: | |
| schedule: | |
| - cron: '0 2 * * *' # Daily at 02:00 UTC | |
| workflow_dispatch: | |
| jobs: | |
| update_pricing: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| virtualenvs-create: true | |
| version: '2.0.1' | |
| - name: Show Poetry version | |
| run: poetry --version | |
| - name: Install project | |
| run: | | |
| poetry install | |
| - name: Run pricing updater | |
| run: | | |
| poetry run python scripts/update_pricing.py | |
| - name: Commit and push if changed | |
| run: | | |
| if [[ -n $(git status --porcelain) ]]; then | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git checkout -b chore/update-pricing-$(date +'%Y%m%d') | |
| git add pricing_data/*.yaml | |
| git commit -m "chore: update pricing data $(date -u +'%Y-%m-%d')" | |
| git push --set-upstream origin HEAD | |
| else | |
| echo "No changes in pricing data." | |
| fi | |
| - name: Create pull request | |
| if: | | |
| github.event_name == 'schedule' && github.ref == 'refs/heads/main' | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| title: "chore: update pricing data" | |
| commit-message: "chore: update pricing data" | |
| body: "Automated daily pricing data refresh." | |
| base: main | |
| branch: | | |
| chore/update-pricing-$(date +'%Y%m%d') |