Git Hooks are run by Git during specific actions. Follow the instructions below to enable:
Git hooks need to be added to your local repo for each project,
-
Create Symbolic links in
.git/hooks/
for git hook scripts you want to use-
cd .git/hooks/
-
ln -s ../../scripts/hooks/<HOOK_NAME>.sh <HOOK_NAME>
- enforces that the branch name matches style:
<prefix>/<feature_name>
- enforces that branch is not
main
ordevelop
or prefixed withrelease
- enforces that first line of commit message matches conventional commit (ish) style
<type>:<description>
- enforces that the branch name matches style:
<prefix>/<feature_name>
- warns when changes are getting large since "last merge"
- 25 files
- 400 lines
-
Note: Prefix comes from prefix-lis.sh script, which defines defaults and uses the .github/labels.yaml
file
- Ensure Program Compiles before commit
- Run tests before commit
- only if code files touched?
- only run tests affected by code files modified?
- Prevent Commit based on Github Branch protections
- requires reading from github API
- https://docs.github.com/en/free-pro-team@latest/rest/reference/repos#get-branch-protection
- use curl and
-u
flag to retrieve branches protected - add to config file that hook reads?
./.github/config.yml
prevent_push: ["<branch_name>"]
- requires reading from github API
- Server side hooks
- on receive, deploy newest changes