diff --git a/build/get-plugin-rev.sh b/build/get-plugin-rev.sh index 3f6913477..f02499c7e 100755 --- a/build/get-plugin-rev.sh +++ b/build/get-plugin-rev.sh @@ -1,7 +1,8 @@ #!/usr/bin/env bash # Script to get number of commits from the last OPA revendoring -GIT_SHA=$(git log -n 1 --pretty=format:%H -- vendor/github.com/open-policy-agent/opa) +LINE=$(git grep -n "github.com/open-policy-agent/opa " go.mod | awk -F: '{ print $2 }') +GIT_SHA=$(git log -n 1 --pretty=format:%H -L $LINE,$LINE:go.mod | head -1) COMMITS=$(git rev-list $GIT_SHA..HEAD --count) if [ $COMMITS -ne 0 ]; then