Skip to content

Commit 1a7066c

Browse files
authored
Fail if poetry.lock has fallen out of sync with pyproject.toml (#2)
Signed-off-by: Sean Quah <[email protected]>
1 parent 354f85b commit 1a7066c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,16 @@ runs:
6060
path: ${{ steps.poetry-venvs.outputs.dir }}
6161
key: poetry-venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
6262

63+
- name: Check that the poetry lockfile is up to date
64+
# This is rather hacky. We look for the warning message in poetry's
65+
# output. We really want to use `poetry lock --check`, but that is only
66+
# available in poetry 1.2.
67+
# https://github.com/python-poetry/poetry/issues/1406
68+
run: >-
69+
poetry export --without-hashes | (! grep "The lock file is not up to date") ||
70+
(echo pyproject.toml was updated without running \`poetry lock --no-update\`. && false)
71+
shell: bash
72+
6373
- name: Install dependencies
6474
if: "${{ steps.poetry-venv-cache.outputs.cache-hit != 'true' }}"
6575
run: poetry install --no-interaction --no-root

0 commit comments

Comments
 (0)