From 0cc95bc45531dbe0b3a4011fef398f6383f75626 Mon Sep 17 00:00:00 2001 From: iancardosozup <86669442+iancardosozup@users.noreply.github.com> Date: Tue, 28 Dec 2021 08:35:12 -0300 Subject: [PATCH] workflows:feature - add go mod tidy check (#904) Now runs a check to see if go.sum file diffs from current version from one generated by go mod tidy command Signed-off-by: Ian Cardoso --- .github/workflows/go-tidy.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/go-tidy.yml diff --git a/.github/workflows/go-tidy.yml b/.github/workflows/go-tidy.yml new file mode 100644 index 000000000..c1319bdbd --- /dev/null +++ b/.github/workflows/go-tidy.yml @@ -0,0 +1,33 @@ +# Copyright 2021 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Go Tidy + +on: + push: + branches: [ main ] + pull_request: +jobs: + go-mod-tidy: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + - name: Set up Golang + uses: actions/setup-go@v2 + with: + go-version: 1.17 + ## Run go mod tidy and then check if there was a diff. If so, fail the check. + - name: Check go mod tidy diff + run: if [ $(go mod tidy && git diff | wc -l) -gt 0 ]; then git diff && exit 1; fi \ No newline at end of file