File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 77 branches : [ main ]
88
99jobs :
10- # Define the job to run before your matrix job
10+ # Collect available Python versions
1111 get-python-versions :
1212 runs-on : ubuntu-latest
1313 outputs :
14- python-matrix : ${{ steps.get-python-versions-action .outputs.latest-python-versions }}
14+ python-matrix : ${{ steps.trim .outputs.matrix }}
1515 steps :
1616 - uses : snok/latest-python-versions@v1
1717 id : get-python-versions-action
1818 with :
1919 min-version : ' 3.12'
2020
21+ # keep only major.minor and remove duplicates
22+ - name : Keep only major.minor
23+ id : trim
24+ shell : bash
25+ run : |
26+ versions='${{ steps.get-python-versions-action.outputs.latest-python-versions }}'
27+ # → ["3.13.5","3.12.11", ...]
28+ matrix=$(echo "$versions" \
29+ | jq -c 'map(split(".")[:2] | join(".")) | unique')
30+ echo "matrix=$matrix" >> "$GITHUB_OUTPUT"
31+
32+ # Use the trimmed versions list in matrix
2133 test :
2234 needs : [get-python-versions]
2335 runs-on : ${{ matrix.operating-system }}
2436 strategy :
2537 matrix :
2638 operating-system : [ ubuntu-latest, windows-latest, macOS-latest ]
27- # python-version: ${{ fromJson(needs.get-python-versions.outputs.python-matrix) }}
28- python-version : [3.13.5, 3.12.10]
29-
39+ python-version : ${{ fromJson(needs.get-python-versions.outputs.python-matrix) }}
3040 continue-on-error : true
3141
3242 steps :
You can’t perform that action at this time.
0 commit comments