github.com/verrazzano/verrazzano@v1.7.1/ci/scripts/check_if_clean_after_generate.sh (about)

     1  #!/usr/bin/env bash
     2  #
     3  # Copyright (c) 2021, 2023, Oracle and/or its affiliates.
     4  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
     5  #
     6  
     7  # this attempts to detect if someone has made an update and forgot to run make generate
     8  # if so, it dumps out the status and diffs in the output so you can see what the issue was
     9  # we purposely cause the build to fail in this situation - we do not want the build to
    10  # rely on generated files that are not version controlled.
    11  
    12  if [[ -n $(git status --porcelain) ]]; then
    13    git status
    14    git diff
    15    echo "****************************************************************************************************************"
    16    echo "* ERROR: The result of a 'go mod tidy', 'make generate', 'make manifests' or 'make copyright-check' resulted   *"
    17    echo "* in files being modified. These changes need to be included in your PR.                                       *"
    18    echo "****************************************************************************************************************"
    19    exit 1
    20  fi