diff --git a/.husky/hooks/test-runner.sh b/.husky/hooks/test-runner.sh index 4dcfe11..e0220f7 100755 --- a/.husky/hooks/test-runner.sh +++ b/.husky/hooks/test-runner.sh @@ -20,7 +20,12 @@ fi # Run tests echo " - Running tests..." -if pytest --html=tests/test-report/test-report.html; then +# HTML report only when pytest-html is installed (it is optional) +HTML_ARGS="" +if python -c "import pytest_html" 2>/dev/null; then + HTML_ARGS="--html=tests/test-report/test-report.html" +fi +if pytest $HTML_ARGS; then echo " โœ… All tests passed" else echo " โŒ Tests failed. Please fix before pushing." diff --git a/.husky/pre-commit b/.husky/pre-commit index da3763f..a209c95 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,14 @@ #!/usr/bin/env sh +# >>> GitGuardian secret scan (managed by Contentstack Security) >>> +if [ -z "${CI:-}" ]; then + if ! command -v ggshield >/dev/null 2>&1; then + echo "ggshield is not installed - secret scanning is required. Setup: https://contentstack.atlassian.net/wiki/x/FIDVEwE" >&2 + exit 1 + fi + ggshield secret scan pre-commit || exit 1 +fi +# <<< GitGuardian secret scan <<< + # Pre-commit hook to run Talisman and Snyk scans, completing both before deciding to commit # Function to check if a command exists diff --git a/.husky/pre-push b/.husky/pre-push index 55f5168..639ec39 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -1,4 +1,14 @@ #!/usr/bin/env sh +# >>> GitGuardian secret scan (managed by Contentstack Security) >>> +if [ -z "${CI:-}" ]; then + if ! command -v ggshield >/dev/null 2>&1; then + echo "ggshield is not installed - secret scanning is required. Setup: https://contentstack.atlassian.net/wiki/x/FIDVEwE" >&2 + exit 1 + fi + ggshield secret scan pre-push "$@" || exit 1 +fi +# <<< GitGuardian secret scan <<< + echo "๐Ÿš€ Running pre-push checks..." @@ -10,7 +20,12 @@ fi # Run tests to ensure code quality echo "๐Ÿงช Running tests..." -if ! pytest --html=tests/test-report/test-report.html; then +# HTML report only when pytest-html is installed (it is optional) +HTML_ARGS="" +if python -c "import pytest_html" 2>/dev/null; then + HTML_ARGS="--html=tests/test-report/test-report.html" +fi +if ! pytest $HTML_ARGS; then echo "โŒ Tests failed. Please fix before pushing." exit 1 fi diff --git a/CODEOWNERS b/CODEOWNERS index ac7dad0..d9f2fb3 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,4 +1,5 @@ * @contentstack/developer-ecosystem-pr-reviewers .github/workflows/ @contentstack/security-admin **/.snyk @contentstack/security-admin -**/CODEOWNERS @contentstack/security-admin \ No newline at end of file +**/CODEOWNERS @contentstack/security-admin +**/.gitguardian.yaml @contentstack/security-admin \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 2f61310..1509117 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,5 @@ lxml~=6.1.0 ruff==0.11.5 pytest>=7.0.0 pytest-cov>=4.0.0 -pytest-html>=4.2.0 -black>=26.3.1 flake8>=6.0.0 isort>=5.0.0