Skip to content

Latest commit

 

History

17 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

COMP3104 – Developer Operations

GitHub Action Status Badge

CI

Commit Msg Hook (Enforce Commit Message Format)

Ensures commit messages follow a specific pattern. File: .git/hooks/commit-msg

# !/bin/sh
COMMIT_MSG_FILE=$1
COMMIT_MSG=$(cat $COMMIT_MSG_FILE)

if ! echo "$COMMIT_MSG" | grep -Eq "^(feat|fix|docs|style|refactor|test|chore): .+"; then
  echo "Commit message must follow the format: <type>: <description>"
  echo "Example: feat: add user authentication"
  exit 1
fi

Pre-Commit Hook (Lint Code Before Commit)

Ensures that the code is linted before committing. File: .git/hooks/pre-commit

# !/bin/sh
echo "Running pre-commit hook: Linting code..."
node --version
#  npm run lint
if [ $? -ne 0 ]; then
  echo "Linting failed. Fix errors before committing."
  exit 1

Pre-Push Hook (Run Tests Before Push)

Runs tests before allowing a push. File: .git/hooks/pre-push

# !/bin/sh
echo "Running pre-push hook: Running tests..."
npm test
if [ $? -ne 0 ]; then
  echo "Tests failed! Fix them before pushing."
  exit 1
fi

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages