Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup automatic updates for golangci-lint #77

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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=
8 changes: 8 additions & 0 deletions tools/pinversion.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build tools

package tools

// Keep a reference to the code generators so they are not removed by go mod tidy
import (
_ "github.com/golangci/golangci-lint/pkg/exitcodes"
)