Weekly US Household API Update #37
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: Weekly US Household API Update | |
| on: | |
| schedule: | |
| # Every Wednesday at 5 PM EST (10 PM UTC) | |
| - cron: "0 22 * * 3" | |
| # Allow manual trigger | |
| workflow_dispatch: | |
| jobs: | |
| update-packages: | |
| name: Update PolicyEngine Packages | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'PolicyEngine/policyengine-household-api' | |
| steps: | |
| - name: Generate GitHub App token | |
| id: app-token | |
| uses: actions/create-github-app-token@v1 | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: "0.8.5" | |
| - name: Install dependencies | |
| run: | | |
| pip install requests | |
| - name: Check for updates and generate summary | |
| id: check_updates | |
| run: python .github/scripts/check_updates.py | |
| - name: Refresh lockfile | |
| if: steps.check_updates.outputs.has_updates == 'true' | |
| run: uv lock --upgrade-package policyengine-us | |
| - name: No updates available | |
| if: steps.check_updates.outputs.has_updates != 'true' | |
| run: | | |
| echo "::notice::No package updates available. policyengine_us is already at the latest version." | |
| - name: Commit and push changes | |
| if: steps.check_updates.outputs.has_updates == 'true' | |
| env: | |
| UPDATES_SUMMARY: ${{ steps.check_updates.outputs.updates_summary }} | |
| run: bash .github/scripts/commit-weekly-update.sh | |
| - name: Create Pull Request | |
| if: steps.check_updates.outputs.has_updates == 'true' | |
| env: | |
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | |
| run: .github/scripts/create_pr.sh |