-
Notifications
You must be signed in to change notification settings - Fork 156
109 lines (95 loc) · 3.08 KB
/
fix-outdated-tools.yml
File metadata and controls
109 lines (95 loc) · 3.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
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