From b8ad02ab417442e3cd860cdfa2e2ae706752c322 Mon Sep 17 00:00:00 2001 From: Tam Mach Date: Sun, 20 Sep 2020 09:55:19 +1000 Subject: [PATCH] build(go): Check if go.mod and go.sum are up to dated This commit is to add job to check if go.mod and go.sum are up to date. Also add go.sum into .gitattributes so that it will be considered as generated file in PR review. Signed-off-by: Tam Mach --- .gitattributes | 1 + .github/workflows/pr.yml | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000000..32f1001be0a5 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +go.sum linguist-generated diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 6311caa774f4..c4b6fd398f16 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -8,6 +8,21 @@ on: - master pull_request: jobs: + # Check if there any dirty change for go mod tidy + go-mod: + runs-on: ubuntu-latest + steps: + - name: Install Go + uses: actions/setup-go@v2 + with: + go-version: 1.15 + - name: Checkout code + uses: actions/checkout@v2 + - name: Check go mod + run: | + go mod tidy + git diff --exit-code + # We already run the current golangci-lint in tests, but here we test # our GitHub action with the latest stable golangci-lint. golangci-lint: