Skip to content
Open
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
13 changes: 13 additions & 0 deletions .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0

- name: setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: go.mod

- name: install task
run: go install github.com/go-task/task/v3/cmd/task@latest

- name: install golangci-lint
run: go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.12.2

- uses: j178/prek-action@4e14d07f9231acabce116ccfca13b13dd9755ece # v3.0.0

Expand Down
4 changes: 1 addition & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ repos:
- repo: https://github.com/golangci/golangci-lint
rev: v2.12.2
hooks:
- id: golangci-lint
args: ["--timeout=10m"]
- id: golangci-lint-fmt
- repo: local
hooks:
Expand All @@ -67,4 +65,4 @@ repos:
language: system
types: [go]
pass_filenames: false
stages: [pre-push]
stages: [pre-commit, pre-push]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift

Avoid an unconditional network fetch in the pre-commit path.

This stage now runs task cli:lint:ci during pre-commit. That Taskfile task executes git fetch --quiet origin main before linting. Developers without network access, valid Git credentials, or an origin/main branch will be unable to create commits that change Go files.

Keep the fetch in the pre-push or CI path, or provide a pre-commit path that uses a cached base with an explicit stale-base policy.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.pre-commit-config.yaml at line 68, The pre-commit stage currently invokes
the lint task that unconditionally runs git fetch, blocking commits without
network access. Update the hook configuration around the stages entry so Go
linting in pre-commit uses a local or cached base without fetching, while
retaining the fetch-dependent validation in pre-push or CI.

Loading