Skip to content

ci: run lint-staged on changed files instead of full format/lint checks - #44

Closed
titan-ron wants to merge 3 commits into
mainfrom
titan/ci-lint-staged
Closed

ci: run lint-staged on changed files instead of full format/lint checks#44
titan-ron wants to merge 3 commits into
mainfrom
titan/ci-lint-staged

Conversation

@titan-ron

Copy link
Copy Markdown
Collaborator

What

Adds a dedicated 🧹 Lint (staged) workflow (.github/workflows/lint-staged.yml) that runs lint-staged against only the files changed in a PR (or push), and removes the whole-tree Lint and Format steps from ci.yml.

Why

PR #35 (Dependabot bumping prettier 3.8.4 → 3.9.5) failed CI because the new prettier reformatted an untouched line in src/lib/types.ts. The full format:check flags files no one edited in the PR. Running lint-staged scoped to changed files mirrors the local pre-commit hook and avoids failures on unrelated files.

How it works

  • Checks out full history and resolves a diff range: origin/<base>...HEAD for PRs, before...HEAD for pushes (with a fallback for the initial-push / missing-base case).
  • Runs npx lint-staged --diff=<range>, which applies eslint --fix + prettier --write to the changed files and exits non-zero on unfixable lint errors.
  • lint-staged stages any fixes, so git diff --quiet HEAD detects them; if fixes were needed the job prints the diff and fails.

Notes

  • Scope is intentionally reduced to changed files only, per request — the full-tree checks are gone. npm run lint:check / format:check remain available for local/manual use.
  • Because this is a separate workflow, the release job no longer transitively waits on lint/format; those are enforced on the PR before merge.

Add a dedicated lint-staged workflow that lints/formats only the files
changed in a PR (or push) via 'lint-staged --diff', and fail if any fix
is needed. Remove the whole-tree Lint and Format steps from ci.yml.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-code-quality

github-code-quality Bot commented Jul 20, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/jest

The overall coverage in commit eaed853 in the titan/ci-lint-staged branch remains at 67%, unchanged from commit ff12161 in the main branch.


Updated July 20, 2026 13:13 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

titan-ron and others added 2 commits July 20, 2026 15:58
The shallow (--depth=1) fetch of the base branch left no merge-base for
the 'origin/<base>...HEAD' range, so lint-staged failed to resolve
changed files. Fetch the base ref to full depth instead.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Fold the standalone lint-staged workflow into ci.yml as a job named
'sca' and gate 'release' on it, restoring lint/format as a release
prerequisite. Remove the now-redundant lint-staged.yml.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@titan-ron titan-ron closed this Jul 20, 2026
@titan-ron
titan-ron deleted the titan/ci-lint-staged branch July 20, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant