Clean (uninstallable) tools revisions #6
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: Clean (uninstallable) tools revisions | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: '0 9 1 * *' | |
| jobs: | |
| get-lockfiles: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| lockfiles: ${{ steps.set-matrix.outputs.lockfiles }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Get all lock files | |
| id: set-matrix | |
| run: | | |
| lockfiles=$(ls *.yaml.lock | jq -R -s -c 'split("\n")[:-1]') | |
| echo "lockfiles=$lockfiles" >> $GITHUB_OUTPUT | |
| fix-outdated: | |
| needs: get-lockfiles | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| lockfile: ${{ fromJson(needs.get-lockfiles.outputs.lockfiles) }} | |
| fail-fast: false | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.13' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Install dependencies | |
| run: uv pip install --system -r requirements.txt | |
| - name: Fix ${{ matrix.lockfile }} | |
| run: python scripts/fix_outdated.py "${{ matrix.lockfile }}" | |
| - name: Get base name | |
| id: basename | |
| run: echo "name=${LOCKFILE%.yaml.lock}" >> $GITHUB_OUTPUT | |
| env: | |
| LOCKFILE: ${{ matrix.lockfile }} | |
| - name: Upload changes | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: ${{ matrix.lockfile }} | |
| path: | | |
| ${{ matrix.lockfile }} | |
| not-installable-revisions/${{ steps.basename.outputs.name }}.not-installable-revisions.yaml | |
| if-no-files-found: ignore | |
| create-pr: | |
| needs: fix-outdated | |
| if: always() | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| merge-multiple: true | |
| - name: Check for changes | |
| id: check_changes | |
| run: | | |
| if [[ -n $(git status --porcelain) ]]; then | |
| echo "changes=true" >> $GITHUB_OUTPUT | |
| echo "Changes detected in lock files" | |
| else | |
| echo "changes=false" >> $GITHUB_OUTPUT | |
| echo "No changes detected" | |
| fi | |
| - name: Create or update Pull Request | |
| id: cpr | |
| if: steps.check_changes.outputs.changes == 'true' | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| branch: fix-outdated-tools | |
| commit-message: Remove not-installable tool revisions | |
| title: 'Remove not-installable tool revisions' | |
| body: | | |
| This PR was automatically generated by the `fix-outdated-tools` workflow. | |
| Workflow run: [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
| delete-branch: true |