Skip to content

Update dependencies #13382

Update dependencies

Update dependencies #13382

name: Update dependencies
on:
schedule:
# Run every 15 minutes
- cron: '*/15 * * * *'
workflow_dispatch: # Allow manual triggering
jobs:
update-dependencies:
name: File update PR
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
# Checkout main branch
with:
ref: main
token: ${{ steps.app-token.outputs.token }}
- name: Install uv
uses: astral-sh/setup-uv@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Generate API clients
run: |
# Generate clients with correct naming before updating dependencies
./scripts/generate-clients.sh
- name: Update dependencies
id: update
run: |
# Run the update command
make update
# Check if there are changes
if [[ -z $(git status --porcelain) ]]; then
echo "No changes detected"
echo "changes_detected=false" >> $GITHUB_OUTPUT
else
echo "Changes detected"
echo "changes_detected=true" >> $GITHUB_OUTPUT
fi
- name: Create pull request
if: steps.update.outputs.changes_detected == 'true'
run: |
git config --global user.name "policyengine-auto"
git config --global user.email "[email protected]"
git checkout -b update-dependencies
git add .
git commit -m "Update dependencies"
git push origin update-dependencies --force
# Try to create PR, ignore if it already exists
gh pr create \
--title "Update dependencies" \
--body "Automated dependency updates
This PR was automatically created by the dependency update workflow.
Last updated: $(date)" \
--base main \
--head update-dependencies || echo "PR may already exist, continuing..."
env:
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}