Skip to content

Commit

Permalink
Only run trivy check in git hook if we have anything to push
Browse files Browse the repository at this point in the history
  • Loading branch information
rupor-github committed Mar 13, 2023
1 parent 8b311df commit ecb2d86
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmake/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ if [[ $? != 0 ]]; then
exit 1
fi

# without the --exit-code 1 flag - trivy always exists with 0
cd @PROJECT_SOURCE_DIR@
# Check if we actually have commits to push
commits=`git log @{u}..`
if [ -z "$commits" ]; then
exit 0
fi
# without the --exit-code 1 flag - trivy always exists with 0
${scanner} --exit-code 1 fs --ignore-unfixed .

0 comments on commit ecb2d86

Please # to comment.