ci: skip go vet/test/golangci-lint when no .go files changed #334

Closed
opened 2026-07-08 04:26:33 +00:00 by fuzzy · 0 comments
Owner

What

Skip Go toolchain steps in CI when no .go files were modified in the push/PR.

Why

Speeds up CI for documentation-only, config-only, or frontend-only changes. Running go vet, go test, and golangci-lint on an unchanged codebase is wasted cycles.

How

In each CI workflow that invokes Go tooling, add a path filter or step conditional:

- name: Check for Go changes
  id: go-changes
  uses: actions/changed-files@v4
  with:
    files: |
      **/*.go
      go.mod
      go.sum

- name: Run go vet
  if: steps.go-changes.outputs.any_changed == 'true'
  run: go vet ./...

Same pattern for go test and golangci-lint.

Alternatives considered

  • Detect via git diff --name-only — works but is less idiomatic in Forgejo Actions. The changed-files action is cleaner.
  • Always run — current behavior. Simple but wasteful for non-Go PRs.
## What Skip Go toolchain steps in CI when no `.go` files were modified in the push/PR. ## Why Speeds up CI for documentation-only, config-only, or frontend-only changes. Running `go vet`, `go test`, and `golangci-lint` on an unchanged codebase is wasted cycles. ## How In each CI workflow that invokes Go tooling, add a path filter or step conditional: ```yaml - name: Check for Go changes id: go-changes uses: actions/changed-files@v4 with: files: | **/*.go go.mod go.sum - name: Run go vet if: steps.go-changes.outputs.any_changed == 'true' run: go vet ./... ``` Same pattern for `go test` and `golangci-lint`. ## Alternatives considered - **Detect via `git diff --name-only`** — works but is less idiomatic in Forgejo Actions. The `changed-files` action is cleaner. - **Always run** — current behavior. Simple but wasteful for non-Go PRs.
fuzzy self-assigned this 2026-07-08 04:26:33 +00:00
fuzzy added this to the Steeper project 2026-07-08 04:26:33 +00:00
fuzzy changed title from ci optimization to ci: skip go vet/test/golangci-lint when no .go files changed 2026-07-08 04:28:37 +00:00
fuzzy closed this issue 2026-07-08 04:33:37 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/steeper#334
No description provided.