From 7f5c2183c0f63cf09945885707066678fe284710 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Tue, 30 Jun 2026 10:58:06 +0200 Subject: [PATCH] =?UTF-8?q?CI=20-=20configure=20precommit=20hook=20to=20bl?= =?UTF-8?q?ock=20commit=20when=20files=20from=20.claude=E2=80=A6=20(#1149)?= =?UTF-8?q?=20(#1171)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * CI - configure precommit hook to block commit when files from .claude/ and/or .vscode/ directories are staged * fix sanity issue - shebang * Remove local hook and update documentation (cherry picked from commit a4fc40732a8e4dea6d6263dec8fbd29ee6ac131f) Co-authored-by: Bikouo Aubin <79859644+abikouo@users.noreply.github.com> --- .gitignore | 3 ++- .pre-commit-config.yaml | 6 ++++++ CONTRIBUTING.md | 14 ++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 .pre-commit-config.yaml diff --git a/.gitignore b/.gitignore index 84baa731..8e40d545 100644 --- a/.gitignore +++ b/.gitignore @@ -23,8 +23,9 @@ tests/integration/targets/*/*.tgz tests/integration/inventory tests/integration/*-*.yml -# VS Code settings +# IDE and editor settings .vscode/ +.claude/ # Root coverage report for SonarCloud (generated locally or in CI) /coverage.xml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..447a2363 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,6 @@ +repos: + - repo: https://github.com/ansible/cloud-content-ci-automation + rev: precommit_hook + hooks: + - id: block-ide-ai-files + always_run: true diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a336063d..99020d05 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -66,6 +66,20 @@ After installation, you can update documentation Review the changes and create a pull request using updated files. +### Pre-Commit Hooks + +To prevent accidental commits of local configuration and IDE files (specifically `.vscode/` and `.claude/`), this repository utilizes the `pre-commit` framework. + +Please set up the hooks locally before making your first commit: + +```bash +# Install the pre-commit tool +pip install pre-commit + +# Register the hooks with Git +pre-commit install +``` + ### Code of Conduct The `kubernetes.core` collection follows the Ansible project's [Code of Conduct](https://docs.ansible.com/ansible/devel/community/code_of_conduct.html).