@@ -29,32 +29,40 @@ jobs:
2929 - name : Setup Python
3030 uses : actions/setup-python@v5
3131 with :
32- python-version : ' 3.12 '
32+ python-version : ' 3.13 '
3333 - uses : astral-sh/setup-uv@v3
34- - name : detect PEP 735
35- id : pep735
34+ - name : detect method
35+ id : detect
3636 run : |
37- if grep -q dependency-groups pyproject.toml ; then
38- echo "found=1" >> $GITHUB_OUTPUT
37+ if test -f requirements-lint.txt ; then
38+ echo "method=requirements" >> $GITHUB_OUTPUT
39+ elif test -f pyproject.toml && grep -q dependency-groups pyproject.toml ; then
40+ echo "method=pep735" >> $GITHUB_OUTPUT
41+ elif test -f pyproject.toml && grep -q dependency-groups pyproject.toml ; then
42+ echo "method=pyproject" >> $GITHUB_OUTPUT
3943 else
40- echo "found=0 " >> $GITHUB_OUTPUT
44+ echo "method=uvx " >> $GITHUB_OUTPUT
4145 fi
42- - name : pre-commit
43- if : ${{ steps.pep735 .outputs.found == 1 }}
46+ - name : pre-commit (PEP 735)
47+ if : steps.detect .outputs.method == 'pep735'
4448 run : uv run --only-group pre-commit pre-commit run --all
4549 env :
4650 RUFF_OUTPUT_FORMAT : github
4751 REUSE_OUTPUT_FORMAT : github
52+ - name : pre-commit (uvx)
53+ if : steps.detect.outputs.method == 'uvx'
54+ run : uvx pre-commit run --all
55+ env :
56+ RUFF_OUTPUT_FORMAT : github
57+ REUSE_OUTPUT_FORMAT : github
4858 - name : Install dependencies
49- if : ${{ steps.pep735.outputs.found == 0 }}
50- run : |
51- if [ -f requirements-lint.txt ] ; then
52- uv pip install --system -r requirements-lint.txt
53- else
54- uv pip install --system $(sed -n 's/.*"\(pre-commit==\([^"]*\)\)".*/\1/p' pyproject.toml)
55- fi
56- - name : pre-commit
57- if : ${{ steps.pep735.outputs.found == 0 }}
59+ if : steps.detect.outputs.method == 'requirements'
60+ run : uv pip install --system -r requirements-lint.txt
61+ - name : Install dependencies
62+ if : steps.detect.outputs.method == 'pyproject'
63+ run : uv pip install --system $(sed -n 's/.*"\(pre-commit==\([^"]*\)\)".*/\1/p' pyproject.toml)
64+ - name : pre-commit (installed)
65+ if : steps.detect.outputs.method == 'requirements' || steps.detect.outputs.method == 'pyproject'
5866 run : pre-commit run --all
5967 env :
6068 RUFF_OUTPUT_FORMAT : github
0 commit comments