From 666dd5427ccb396896fabf9302edc998e879a198 Mon Sep 17 00:00:00 2001 From: Jason Lynch Date: Wed, 14 Jan 2026 14:20:46 -0500 Subject: [PATCH] ci: fix licenses-ci target Fixes two issues with the licenses-ci target: - go-licenses can output notices in non-deterministic order. I've changed this check to sort the contents of each `NOTICE.txt` before diffing to make it order-independent. - I'm writing these out to temporary files instead of using <() to maintain POSIX compatibility. - Backticks create a subshell in bash and other POSIX shells, which is why the output looked strange when this check fails. I'v replaced the backticks in the "Please commit..." message with single quotes. --- Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2d339aba..7a5c6f3f 100644 --- a/Makefile +++ b/Makefile @@ -140,10 +140,14 @@ licenses: .PHONY: licenses-ci licenses-ci: licenses - @if ! git diff --exit-code NOTICE.txt; then \ - echo "Please commit the updated NOTICE.txt file via `make licenses`."; \ + @sort NOTICE.txt > ./licenses-ci-local.txt + @git show HEAD:NOTICE.txt | sort > ./licenses-ci-upstream.txt + @if ! diff ./licenses-ci-local.txt ./licenses-ci-upstream.txt > /dev/null; then \ + echo "Please commit the updated NOTICE.txt file via 'make licenses'."; \ + rm ./licenses-ci-local.txt ./licenses-ci-upstream.txt; \ exit 1; \ fi + @rm ./licenses-ci-local.txt ./licenses-ci-upstream.txt @echo "NOTICE.txt is up to date." .PHONY: ci