From f4aeaa6387bc23a4f62a9814182c5b7e1cc3a9dd Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Fri, 24 May 2024 21:08:50 +0300 Subject: [PATCH] workflows: protect go.mod from unexpected imports Avoid situations like #3458. Signed-off-by: Anna Shaleva --- .github/workflows/tests.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 3abfa5975..524214bd1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,6 +39,14 @@ jobs: - name: Check dependencies run: | ./scripts/check_deps.sh + - name: Check go.mod is tidy + run: | + go mod tidy + if [[ $(git diff --name-only go.* | grep '' -c) != 0 ]]; then + echo "go mod tidy should be executed before the merge, following packages are unused or out of date:"; + git diff go.*; + exit 1; + fi codegencheck: name: Check code generated with 'go generate' is up-to-date