Files
my-rook-config/tests/scripts/validate_modified_files.sh
T
Michael Adam 93179a41f3 ci: slightly rework the docs-check workflow
This reworks the docs-check ci workflow in several ways:

* It renames the make target 'check-docs' to the  more systematic 'check.docs'.
* It adds a 'docs'mode to the  files validation script, and uses the script in `make check.docs`.

Overall, the workflow and local make targets are more systematic and
consistent with this change.

Signed-off-by: Michael Adam <obnox@samba.org>
2024-09-05 22:09:40 +02:00

55 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env -S bash
set -ex
#############
# VARIABLES #
#############
CODEGEN_ERR="found codegen files! please run 'make codegen' and update your PR"
MOD_ERR="changes found by mod.check. You may need to run make clean"
CRD_ERR="changes found by 'make crds'. please run 'make crds' locally and update your PR"
BUILD_ERR="changes found by make build', please commit your go.sum or other changed files"
HELM_ERR="changes found by 'make gen-rbac'. please run 'make gen-rbac' locally and update your PR"
DOCS_ERR="changes found by 'make docs'. please run 'make docs' locally and update your PR"
#############
# FUNCTIONS #
#############
function validate(){
git=$(git status --porcelain)
for file in $git; do
if [ -n "$file" ]; then
echo "$1"
echo "$git"
git diff
exit 1
fi
done
}
########
# MAIN #
########
case "$1" in
docs)
validate "$DOCS_ERR"
;;
codegen)
validate "$CODEGEN_ERR"
;;
modcheck)
validate "$MOD_ERR"
;;
crd)
validate "$CRD_ERR"
;;
build)
validate "$BUILD_ERR"
;;
gen-rbac)
validate "$HELM_ERR"
;;
*)
echo $"Usage: $0 {docs|codegen|modcheck|crd|build|gen-rbac}"
exit 1
esac