Files
Sam Morrow e7e2925666 fix: update licenses-check to use new architecture-aware format
- Check now regenerates using ./script/licenses and compares
- Add GOROOT/PATH setup in CI to fix go-licenses module info errors
- Check both license files AND third-party directory for changes
- See: https://github.com/google/go-licenses/issues/244
2025-12-12 16:36:59 +01:00

35 lines
1006 B
Bash
Executable File

#!/bin/bash
#
# Check that license files are up to date.
# This script regenerates the license files and compares them with the committed versions.
# If there are differences, it exits with an error.
set -e
# Store original files for comparison
TEMPDIR="$(mktemp -d)"
trap "rm -fr ${TEMPDIR}" EXIT
# Save original license markdown files
for goos in darwin linux windows; do
cp "third-party-licenses.${goos}.md" "${TEMPDIR}/"
done
# Save the state of third-party directory
cp -r third-party "${TEMPDIR}/third-party.orig"
# Regenerate using the same script
./script/licenses
# Check for any differences in workspace
if ! git diff --exit-code --quiet third-party-licenses.*.md third-party/; then
echo "License files are out of date:"
git diff third-party-licenses.*.md third-party/
echo ""
printf "\nLicense check failed.\n\nPlease update the license files by running \`./script/licenses\` and committing the output.\n"
exit 1
fi
echo "License check passed for all platforms."