diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 6d0b7f78b11c..91fedf933722 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -67,6 +67,8 @@ jobs: git config --global core.autocrlf false - uses: actions/checkout@v5 + with: + fetch-depth: 0 - uses: Chia-Network/actions/setup-python@main with: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 01b7da6b4d62..58caa8c7ae3d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -40,9 +40,10 @@ repos: hooks: - id: poetry name: poetry - entry: ./activated.py --poetry poetry check --strict + entry: ./activated.py --poetry python poetry-check.py language: system pass_filenames: false + files: "^(poetry.lock|poetry.toml|pyproject.toml)$" - repo: https://github.com/pre-commit/mirrors-prettier rev: v3.1.0 hooks: diff --git a/poetry-check.py b/poetry-check.py new file mode 100644 index 000000000000..1f44fe9d485e --- /dev/null +++ b/poetry-check.py @@ -0,0 +1,28 @@ +from __future__ import annotations + +import subprocess +import sys + + +def main() -> int: + subprocess.run( + [ + "poetry", + "check", + "--strict", + ], + check=True, + ) + subprocess.run( + [ + "poetry", + "lock", + ], + check=True, + ) + + return 0 + + +if __name__ == "__main__": + sys.exit(main())