Skip to content

Commit e6343d5

Browse files
n-thumanngreenbonebot
authored andcommitted
Add: Options to allow uv in lint-python
1 parent cda228b commit e6343d5

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

lint-python/action.yaml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ inputs:
99
python-version:
1010
description: "Python version that should be installed"
1111
default: "3.10"
12+
package-manager:
13+
description: "Package manager to use. Default is 'poetry'."
14+
default: "poetry"
1215
poetry-version:
1316
description: "Use a specific poetry version. By default the latest release is used."
17+
uv-version:
18+
description: "Use a specific uv version. By default the latest release is used."
1419
cache:
1520
description: "Cache dependencies by setting it to 'true'. Leave unset or set to an other string then 'true' to disable the cache."
1621
cache-dependency-path:
@@ -38,7 +43,8 @@ branding:
3843
runs:
3944
using: "composite"
4045
steps:
41-
- name: Install poetry
46+
- if: ${{ inputs.package-manager == 'poetry' }}
47+
name: Install poetry
4248
uses: greenbone/actions/poetry@v3
4349
with:
4450
python-version: ${{ inputs.python-version }}
@@ -48,11 +54,25 @@ runs:
4854
cache-poetry-installation: ${{ inputs.cache-poetry-installation }}
4955
install-dependencies: ${{ inputs.install-dependencies }}
5056
working-directory: ${{ inputs.working-directory }}
51-
- run: poetry run ${{ inputs.formatter }} ${{ inputs.packages }}
57+
- if: ${{ inputs.package-manager == 'uv' }}
58+
name: Install uv
59+
uses: greenbone/actions/uv@v3
60+
with:
61+
python-version: ${{ inputs.python-version }}
62+
uv-version: ${{ inputs.uv-version }}
63+
enable-cache: ${{ inputs.cache }}
64+
cache-dependency-glob: ${{ inputs.cache-dependency-path }}
65+
working-directory: ${{ inputs.working-directory }}
66+
- if: ${{ inputs.package-manager == 'uv' && inputs.install-dependencies == 'true' }}
67+
name: Install dependencies with uv
68+
run: uv sync
69+
shell: bash
70+
working-directory: ${{ inputs.working-directory }}
71+
- run: ${{ inputs.package-manager }} run ${{ inputs.formatter }} ${{ inputs.packages }}
5272
shell: bash
5373
name: Check with ${{ inputs.formatter }}
5474
working-directory: ${{ inputs.working-directory }}
55-
- run: poetry run ${{ inputs.linter }} ${{ inputs.packages }}
75+
- run: ${{ inputs.package-manager }} run ${{ inputs.linter }} ${{ inputs.packages }}
5676
shell: bash
5777
name: Check with ${{ inputs.linter }}
5878
working-directory: ${{ inputs.working-directory }}

0 commit comments

Comments
 (0)