From 8222fa3e514730c6a7d7b4ac9dbaf86db52273f0 Mon Sep 17 00:00:00 2001 From: Simon Deziel Date: Mon, 9 Dec 2024 14:18:18 -0500 Subject: [PATCH] Makefile: propose commit'ing generated files after `make update-api` Signed-off-by: Simon Deziel --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 1cf7b2778515..d4f30f12db36 100644 --- a/Makefile +++ b/Makefile @@ -157,6 +157,12 @@ endif @# Generate spec and exclude package from dependency which causes a 'classifier: unknown swagger annotation "extendee"' error. @# For more details see: https://github.com/go-swagger/go-swagger/issues/2917. swagger generate spec -o doc/rest-api.yaml -w ./lxd -m -x github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options + if [ -t 0 ] && ! git diff --quiet -- ./doc/rest-api.yaml; then \ + read -rp "Would you like to commit swagger YAML changes (Y/n)? " answer; \ + if [ "$${answer:-y}" = "y" ] || [ "$${answer:-y}" = "Y" ]; then \ + git commit -S -sm "doc/rest-api: Refresh swagger YAML" -- ./doc/rest-api.yaml;\ + fi;\ + fi .PHONY: update-metadata update-metadata: build