|
| 1 | +--- |
| 2 | +# This GitHub action is meant to update the pipfile.locks |
| 3 | +name: uv.locks Renewal Action |
| 4 | + |
| 5 | +on: # yamllint disable-line rule:truthy |
| 6 | + # Triggers the workflow every Wednesday at 1am UTC |
| 7 | + schedule: |
| 8 | + - cron: "0 1 * * 3" |
| 9 | + workflow_dispatch: # for manual trigger workflow from GH Web UI |
| 10 | + inputs: |
| 11 | + branch: |
| 12 | + description: 'Specify branch' |
| 13 | + required: false |
| 14 | + default: 'main' |
| 15 | + python_version: |
| 16 | + description: 'Select Python version to update uv.lock' |
| 17 | + required: false |
| 18 | + default: '3.11' |
| 19 | + type: choice |
| 20 | + options: |
| 21 | + - '3.12' |
| 22 | + - '3.11' |
| 23 | + update_optional_dirs: |
| 24 | + description: 'Include optional directories in update' |
| 25 | + required: false |
| 26 | + default: 'false' |
| 27 | + type: choice |
| 28 | + options: |
| 29 | + - 'true' |
| 30 | + - 'false' |
| 31 | + |
| 32 | +jobs: |
| 33 | + build: |
| 34 | + runs-on: ubuntu-latest |
| 35 | + permissions: |
| 36 | + contents: write |
| 37 | + env: |
| 38 | + BRANCH: ${{ github.event.inputs.branch || 'main' }} |
| 39 | + PYTHON_VERSION: ${{ github.event.inputs.python_version || '3.11' }} |
| 40 | + INCLUDE_OPT_DIRS: ${{ github.event.inputs.update_optional_dirs || 'false' }} |
| 41 | + steps: |
| 42 | + # Checkout the specified branch from the specified organization |
| 43 | + - name: Checkout code from the specified branch |
| 44 | + uses: actions/checkout@v4 |
| 45 | + with: |
| 46 | + ref: ${{ env.BRANCH }} |
| 47 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 48 | + |
| 49 | + # Configure Git |
| 50 | + - name: Configure Git |
| 51 | + run: | |
| 52 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 53 | + git config --global user.name "GitHub Actions" |
| 54 | +
|
| 55 | + # Setup Python environment with the specified version (or default to '3.11') |
| 56 | + - name: Setup Python environment |
| 57 | + uses: actions/setup-python@v5 |
| 58 | + with: |
| 59 | + python-version: ${{ env.PYTHON_VERSION }} |
| 60 | + |
| 61 | + # Install uv |
| 62 | + - name: Install uv |
| 63 | + run: pip install uv |
| 64 | + |
| 65 | + # Run makefile recipe to refresh uv.lock and push changes back to the branch |
| 66 | + - name: Run make refresh-pipfilelock-files and push the changes back to the branch |
| 67 | + run: | |
| 68 | + uv lock --python ${{ env.PYTHON_VERSION }} |
| 69 | + git add uv.lock |
| 70 | + git commit -m "Update uv.lock files by uvlock-renewal.yaml action" |
| 71 | + git push origin ${{ env.BRANCH }} |
0 commit comments