Add precommit for secret scanning, formatting and license header checking. (#2938)

* Add precommit for secret scanning, formatting and license header checking.

* Turn off bash debug logging.

* Skip precommit checks that apply to all files.

There are too many violations to run against all files.

(cherry picked from commit b00e11cb6f)
This commit is contained in:
Tom Page
2024-09-25 10:35:39 +01:00
committed by Tom Page
parent 27e955e947
commit 3f2f654ac9
7 changed files with 2432 additions and 23 deletions

View File

@@ -0,0 +1,21 @@
#!/usr/bin/env bash
set +x
if [[ -z ${GITHUB_MODIFIED_FILES} ]]
then
modified_files=$(git diff --cached --name-only --diff-filter=ACMR)
else
modified_files=${GITHUB_MODIFIED_FILES}
fi
include_list=""
for file in ${modified_files}
do
include_list="${include_list},${file}"
done
include_list=${include_list:1}
mvn spotless:apply validate -DlicenseUpdateHeaders=true -Pags,all-tas-tests -Dspotless-include-list="${include_list}" > /dev/null || true
set -x