Skip to content

Commit d15737b

Browse files
authored
add poetry check (#148)
1 parent fc6eaee commit d15737b

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

.vscode/cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"mdformat",
3636
"minlevel",
3737
"printf",
38+
"pyproject",
3839
"redhat",
3940
"venv",
4041
"virtualenvs",

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ steps:
4040
| architecture | The target architecture (x86, x64) of the Python interpreter.The target architecture (x86, x64) of the Python interpreter. |
4141
| cache-key-suffix | Temporary input to allow for slight customization of the cache key until full customization can be provided. This will be removed in the future. |
4242
| ensure-cache-is-healthy | Ensure the cached Python virtual environment is healthy. In most cases, this should be left set to `true` (default). _(non-Windows only)_ |
43+
| poetry-check | Whether validate the content of the `pyproject.toml` file and its consistency with the `poetry.lock` file. |
44+
| poetry-check-cmd | The poetry command to run when checking the lock file (e.g. `check`). This command was changed in poetry 1.6 (default used by this action). To support older versions of poetry, provide a value for this input. |
4345
| poetry-install | Whether to run `poetry install` (or the value of `poetry-install-cmd`). Defaults to `true`. |
4446
| poetry-install-args | Additional args to pass to `poetry install`. Defaults to `-vvv --remove-untracked` |
4547
| poetry-install-cmd | Command for installing poetry project. Can be used to provide a custom install command. The value of `poetry-install-args` is appended after this. Defaults to `poetry install`. This is also a check for the existence of a `Makefile` with a `setup-poetry` target. If found, using it takes precedence. |

action.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@ inputs:
1919
In most cases, this should be left set to `true` (default). _(non-Windows only)_
2020
required: false
2121
default: true
22+
poetry-check:
23+
description: Whether validate the content of the `pyproject.toml` file and its consistency with the `poetry.lock` file.
24+
required: false
25+
default: true
26+
poetry-check-cmd:
27+
description: |
28+
The poetry command to run when checking the lock file (e.g. `check`).
29+
This command was changed in poetry 1.6 (default used by this action).
30+
To support older versions of poetry, provide a value for this input.
31+
required: false
32+
default: check
2233
poetry-install:
2334
description: Whether to run `poetry install`.
2435
required: false
@@ -85,6 +96,12 @@ runs:
8596
steps.composite-python-venv-cache.outputs.cache-hit == 'true'
8697
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
8798
shell: bash
99+
- name: Check pyproject.toml & poetry.lock
100+
if: inputs.poetry-check == 'true'
101+
env:
102+
POETRY_CHECK_CMD: ${{ inputs.poetry-check-cmd }}
103+
run: poetry ${POETRY_CHECK_CMD}
104+
shell: bash
88105
- name: Install Dependencies
89106
if: inputs.poetry-install == 'true'
90107
env:

0 commit comments

Comments
 (0)