feat: support uv.lock as version-file (#379)

Adds `uv.lock` as a supported `version-file` format, alongside the
existing
`pyproject.toml` and `requirements.txt`. A `uv.lock` pins the exact
resolved
ruff version, so reading it gives a reproducible install that matches
the
project's lockfile — the single source of truth — instead of the
lower-bound /
range typically declared in `pyproject.toml`.

The parser reads the `[[package]]` entry whose `name` is `ruff` and
returns its
`version`. If ruff is absent or the file cannot be parsed, the action
warns and
falls back to `latest` (same behaviour as the other formats).

Validation:
- `npm run all` — tsc typecheck clean, biome clean, dist rebuilt, jest
65/65 pass
- Added unit tests (`__tests__/version/file-parser.test.ts`) + a
`uv.lock` fixture
- Added an integration job (`test-default-version-from-uv-lock`) that
runs the
  action against the fixture and asserts ruff 0.9.5 is installed

closes #375
This commit is contained in:
somaz
2026-07-05 11:56:05 +02:00
committed by GitHub
parent 270e80dfe7
commit f3db229c84
8 changed files with 112 additions and 8 deletions
+3 -3
View File
@@ -178,14 +178,14 @@ to install the latest version that satisfies the range.
#### Install a version from a specified version file
You can specify a file to read the version from.
Currently `pyproject.toml` and `requirements.txt` are supported. If the file cannot be parsed
or does not contain a Ruff version, the action warns and falls back to `latest`.
Currently `pyproject.toml`, `requirements.txt` and `uv.lock` are supported. If the file cannot
be parsed or does not contain a Ruff version, the action warns and falls back to `latest`.
```yaml
- name: Install a version from a specified version file
uses: astral-sh/ruff-action@v4.0.0
with:
version-file: "my-path/to/pyproject.toml-or-requirements.txt"
version-file: "my-path/to/pyproject.toml-requirements.txt-or-uv.lock"
```
Version resolution precedence is: