From c51324224ce3613801df545cefe09264328a1c3b Mon Sep 17 00:00:00 2001 From: kruthika04 <55175732+kruthika04@users.noreply.github.com> Date: Fri, 22 Sep 2023 13:33:24 -0700 Subject: [PATCH] Enhance workFlow to add git mod tidy (#458) Signed-off-by: kruthika04 --- .github/workflows/test-on-push.yaml | 3 +++ .github/workflows/validate_examples.yaml | 2 ++ Makefile | 9 +++++++++ 3 files changed, 14 insertions(+) diff --git a/.github/workflows/test-on-push.yaml b/.github/workflows/test-on-push.yaml index af81fc8d..b385ef36 100644 --- a/.github/workflows/test-on-push.yaml +++ b/.github/workflows/test-on-push.yaml @@ -52,3 +52,6 @@ jobs: version: ${{ env.GOLANGCILINT_VER }} skip-cache: true args: --timeout=10m0s + + - name: Run go mod tidy check diff + run: make modtidy check-diff diff --git a/.github/workflows/validate_examples.yaml b/.github/workflows/validate_examples.yaml index 0446c1d1..62a52df3 100644 --- a/.github/workflows/validate_examples.yaml +++ b/.github/workflows/validate_examples.yaml @@ -41,6 +41,8 @@ jobs: run: | python -m pip install --upgrade pip pip install mechanical-markdown + - name: Run go mod tidy check diff + run: make modtidy check-diff - name: Set up Dapr CLI run: wget -q ${{ env.DAPR_INSTALL_URL }} -O - | /bin/bash -s ${{ env.DAPR_CLI_VER }} - name: Set up Go ${{ env.GOVER }} diff --git a/Makefile b/Makefile index 2699c2f5..01ea3552 100644 --- a/Makefile +++ b/Makefile @@ -41,3 +41,12 @@ tag: ## Creates release tag help: ## Display available commands @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk \ 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +.PHONY: check-diff +check-diff: + git diff --exit-code ./go.mod # check no changes + git diff --exit-code ./go.sum # check no changes + +.PHONY: modtidy +modtidy: + go mod tidy