github.com/snyk/vervet/v5@v5.11.1-0.20240202085829-ad4dd7fb6101/scripts/docs.bash (about)

     1  #!/usr/bin/env bash
     2  set -eu
     3  cd $(dirname $0)/..
     4  
     5  # Ensure there is a GOPATH set
     6  if [ -z "${GOPATH:-}" ]; then
     7      tmp_gopath=$(mktemp -d)
     8      trap "chmod -R u+w $tmp_gopath; rm -rf $tmp_gopath" EXIT
     9      export GOPATH=$tmp_gopath
    10  fi
    11  export PATH=$GOPATH/bin:$PATH
    12  
    13  go install github.com/cmars/greenroom@v0.1.0
    14  
    15  greenroom ./...
    16  
    17  # Exit 0 if documentation unchanged, non-zero if there are changes.
    18  # Supports CI gating on docs being up to date.
    19  
    20  output=$(git status --porcelain)
    21  if [ -z "$output" ]; then
    22      echo "No documentation changes"
    23      exit 0
    24  fi
    25  
    26  echo "Documentation has changed: $output"
    27  exit 1