From a26c7c88aadc930950616c71bf3794e31b6acd89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingy=20d=C3=B6t=20Net?= Date: Sun, 5 Jan 2025 13:37:12 -0500 Subject: [PATCH] Add 'make diff' support with yq to workflow Makefile --- .github/workflows-src/Makefile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows-src/Makefile b/.github/workflows-src/Makefile index 9aa709a6..7f40cbe5 100644 --- a/.github/workflows-src/Makefile +++ b/.github/workflows-src/Makefile @@ -19,6 +19,21 @@ test: force build @git diff --exit-code ../workflows && \ echo -e '\nPASS - No normative changes to .github/workflows' +DIFF_ORIG_COMMIT ?= HEAD +diff: + @for f in $(SOURCE_FILES); do \ + f=$${f##*/}; \ + diff -u --color=auto \ + <(yq -P 'sort_keys(..)' \ + -o=props <(git show $(DIFF_ORIG_COMMIT):.github/workflows/$$f) | \ + grep -Ev '(^$$|^#)' \ + ) \ + <(yq -P 'sort_keys(..)' \ + -o=props ../workflows/$$f | \ + grep -Ev '(^$$|^#)'\ + ); \ + done + force: touch *.yml