Skip to content

Conversation

@sebastiancorrea81
Copy link
Collaborator

Summary

Adds pre-commit validations using husky, matching the same hooks used in test-ci-tofu:

  • Branch name validation: Ensures branch names follow pattern type/description
  • OpenTofu format check: Runs tofu fmt -check -recursive
  • OpenTofu validation: Runs tofu validate on all modules
  • Commitlint: Validates commit messages follow conventional commits
  • tfsec security scan: Runs security scan on staged .tf files (if installed)

Files added

  • package.json - npm dependencies (husky, commitlint)
  • package-lock.json - lock file
  • .husky/pre-commit - pre-commit hook script
  • .husky/commit-msg - commit message validation hook

Test plan

  • Tested format validation (fails if not formatted)
  • Tested terraform validation (validates all modules)
  • Tested commitlint (rejects invalid commit messages)
  • Tested branch name validation

🤖 Generated with Claude Code

@github-actions
Copy link
Contributor

Security Scan Failed

tfsec found security issues with HIGH or higher severity.

Please review the workflow logs and fix the issues before merging.

View Details

@violenti
Copy link
Collaborator

@sebastiancorrea81 The security job failed

Resolved conflicts:
- .github/workflows/docs.yml: kept main's workflow references
- .github/workflows/linter.yml: kept main's workflow references
- commitlint.config.mjs: removed as per branch decision

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@sebastiancorrea81 sebastiancorrea81 merged commit 832faf7 into main Feb 3, 2026
36 checks passed
@sebastiancorrea81 sebastiancorrea81 deleted the chore/add-husky-hooks branch February 3, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants