Add license check #9

Merged
nupplaphil merged 4 commits from feat/license_check into stable 2022-07-04 01:22:53 +02:00
Showing only changes of commit 5c35459a18 - Show all commits

View file

@ -5,13 +5,17 @@
[[ -z "${CHANGED_FILES}" ]] && exit 0 [[ -z "${CHANGED_FILES}" ]] && exit 0
IFS=' ' read -ra files <<<"${CHANGED_FILES//$'\n'/ }"
current_year=$(date +"%Y") current_year=$(date +"%Y")
php_template_md5=$(sed "s/%%YEAR%%/$current_year/g" "mods/license/license_php.template" | md5sum) php_template_md5=$(sed "s/%%YEAR%%/$current_year/g" "mods/license/license_php.template" | md5sum)
php_template_rows=$(wc -l "mods/license/license_php.template" | cut -d" " -f1) php_template_rows=$(wc -l "mods/license/license_php.template" | cut -d" " -f1)
exitVal=0 exitVal=0
for file in "${CHANGED_FILES[@]}"; do printf "\n"
for file in "${files[@]}"; do
php_license_md5=$(head -n "$php_template_rows" "$file" | md5sum) php_license_md5=$(head -n "$php_template_rows" "$file" | md5sum)
[[ "$php_template_md5" != "$php_license_md5" ]] && printf " - %s\n" "$file" && exitVal=1 [[ "$php_template_md5" != "$php_license_md5" ]] && printf " - %s\n" "$file" && exitVal=1
done done