Git hook
We can ensure that we don't push code that puts the workspace in an invalid state, by adding a git hook to our workspace, that executes the check command.
To make this work, all developers should add .git/hooks/commit-msg to the root of the workspace on their local disk with the following content, e.g.:
#!/usr/bin/env bash
exec /usr/bin/java -jar /usr/local/polylith/poly.jar check color-mode:none ws-dir:PATH-TO-WORKSPACE-DIRECTORY
if [[ $? -ne 0 ]] ; then
exit 1
Replace PATH-TO-WORKSPACE-DIRECTORY with the path to the workspace root.
Export as PDF
Copy link