diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index ea60672b..a13aea3c 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -43,6 +43,22 @@ jobs: - run: echo "${HOME}/.local/bin" >> ${GITHUB_PATH} - run: cd c2cciutils; npm install - run: python3 -m pip install --user --requirement=requirements.txt + + - uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} + restore-keys: "pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}\npre-commit-" + - run: pre-commit run --all-files + - run: git diff --exit-code --patch > /tmp/pre-commit.patch || true + if: failure() + - uses: actions/upload-artifact@v4 + with: + name: Apply pre-commit fix.patch + path: /tmp/pre-commit.patch + retention-days: 1 + if: failure() + - run: poetry build env: POETRY_DYNAMIC_VERSIONING_BYPASS: 0.0.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7d7f60c3..05569838 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,6 +9,10 @@ repos: rev: 1.0.0 hooks: - id: copyright + exclude: |- + (?x)^( + example-project/.* + ) - id: poetry-lock additional_dependencies: - poetry==1.3.2 # pypi diff --git a/LICENSE.txt b/LICENSE.txt index 2ce6a0c9..56fcfac0 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ All the code in this library is provided under this license: - Copyright (c) 2020, Camptocamp SA + Copyright (c) 2020-2024, Camptocamp SA All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/requirements.txt b/requirements.txt index d6498745..5c03e4e8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,7 @@ poetry==1.3.2 poetry-plugin-export==1.2.0 poetry-dynamic-versioning[plugin]==0.19.0 poetry-plugin-tweak-dependencies-version==1.2.1 +pre-commit==3.8.0 pip==23.3.2 importlib-metadata>=7.0.0,<8.0.0 certifi>=2024.7.4 # not directly required, pinned by Snyk to avoid a vulnerability