Upgrade uv packages #4
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
| --- | |
| ## Github Action to upgrade all packages with uv | |
| name: Upgrade uv packages | |
| on: | |
| ## Make this an on-demand Action | |
| workflow_dispatch: | |
| jobs: | |
| bump-dependencies: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| ## Checkout code | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| ## Install uv in pipeline | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: "${{ inputs.uv_version || 'latest' }}" | |
| ## Update packages | |
| - name: Upgrade dependencies | |
| run: uv lock -U | |
| ## Commit and push changes | |
| - name: Commit and push changes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| if ! git diff --quiet; then | |
| echo "Changes detected. Committing..." | |
| git add pyproject.toml uv.lock | |
| COMMIT_MESSAGE="${{ github.event.inputs.commit_message || 'chore: update requirements' }}" | |
| git commit -m "$COMMIT_MESSAGE" | |
| git push origin HEAD:${{ github.ref_name }} | |
| else | |
| echo "No changes detected. Skipping commit." | |
| fi | |
| ## Open new PR to main | |
| - name: Create PR for dependency updates | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| branch: chore/bump-depends | |
| commit-message: "${{ github.event.inputs.commit_message || 'chore: update requirements' }}" | |
| title: "${{ github.event.inputs.commit_title || 'Update requirements*.txt files' }}" | |
| body: "${{ github.event.inputs.commit_body || 'Export production & dev requirements' }}" | |
| base: main |