Skip to content

Instantly share code, notes, and snippets.

@colestrode
colestrode / audit.sh
Last active May 20, 2018 20:30
Lint on commit, audit on push
#!/bin/bash
# This will automatically run npm audit fix on your branch and commit the changes with a commit message that includes the current branch name
# It will not run on develop or master branches
# You can skip it on other branches with the --no-verify command line option: git push origin branch --no-verify
BRANCH=`git rev-parse --abbrev-ref HEAD`
MESSAGE="$BRANCH npm audit fix"
if [[ $BRANCH = 'master' ]] || [[ $BRANCH = 'develop' ]] ; then
echo 'skipping audit on '$BRANCH' branch'
exit 0