Version Control
Git Hooks
Git Hooks are git’s system for triggering custom scripts when certain important actions occur. This project uses husky to automatically install git hooks for developers.
The scripts themselves can be found in the .husky
folder. Their actions are summarised here:
commit-msg
Lint the commit message to ensure it matches Conventional Commits specification.
pre-commit
- Generates a
README
for the terraform configuration. - Formats all staged files using prettier
- Lints all the terraform configuration using TFLint
- Lints source code using each affected project’s linter
- Runs all the unit tests for affected projects
For details on what “affected” projects are, see Nx.
pre-push
Runs the end-to-end tests for all affected projects.
For details on what “affected” projects are, see Nx.
GitHub
As I am using GitOps, it is imperative that all commits on the main
are in a production ready state.
Using Github’s protected branches, any commits directly to the main
branch are rejected. For a commit to be included on main
it must be:
- A verified signed commit;
- Committed to a branch other than
main
and merged via pull request; - All required GitHub actions must have been run against it and pass.
This ensures that, in so far as possible, the main
branch is production ready.