Skip to content

Commit

Permalink
Setup automatic updates for golangci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear committed Jul 2, 2024
1 parent 85a35ef commit 6948353
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 7 deletions.
6 changes: 4 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ updates:
directory: "/"
schedule:
interval: weekly
day: "sunday"
time: "11:00"
- package-ecosystem: gomod
directory: "/tools"
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: "/"
schedule:
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ on:
pull_request:
branches: [main]

env:
GOLANGCI_LINT_VERSION: v1.57.2

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -22,7 +19,11 @@ jobs:
go-version: 'stable'
check-latest: true

- id: golangci-lint-version
run: |
make gh-lint-version >> $GITHUB_OUTPUT
- uses: golangci/golangci-lint-action@v6
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
version: ${{ steps.golangci-lint-version.outputs.GOLANGCI_LINT_VERSION }}
args: --verbose --timeout 5m
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export GOBIN := $(MAKEFILE_PATH)/bin

PATH := $(GOBIN):$(PATH)

GOLANGCI_LINT_VERSION=$(shell awk '/GOLANGCI_LINT_VERSION:/ { print $$2 }' .github/workflows/lint.yml)
GOLANGCI_LINT_VERSION ?= $(shell cd tools; go list -m -f '{{.Version}}' github.com/golangci/golangci-lint)

.PHONY: all
all: clean format build lint test
Expand Down Expand Up @@ -36,6 +36,10 @@ lint:
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
@$(GOBIN)/golangci-lint run

.PHONY: gh-lint-version
gh-lint-version:
@echo "GOLANGCI_LINT_VERSION=$(GOLANGCI_LINT_VERSION)"

.PHONY: format
format:
@echo format
Expand Down
5 changes: 5 additions & 0 deletions tools/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/alexandear/import-gitlab-commits/tools

go 1.22

require github.com/golangci/golangci-lint v1.57.2
2 changes: 2 additions & 0 deletions tools/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/golangci/golangci-lint v1.57.2 h1:NNhxfZyL5He1WWDrIvl1a4n5bvWZBcgAqBwlJAAgLTw=
github.com/golangci/golangci-lint v1.57.2/go.mod h1:ApiG3S3Ca23QyfGp5BmsorTiVxJpr5jGiNS0BkdSidg=
7 changes: 7 additions & 0 deletions tools/tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//go:build tools

package tools

import (
_ "github.com/golangci/golangci-lint/pkg/exitcodes"
)

0 comments on commit 6948353

Please sign in to comment.