Skip to content

[lint apply] Add PR-only pre-commit workflow & lint all#166

Open
C-Achard wants to merge 7 commits intocy/linter-cifrom
cy/linter-ci-apply
Open

[lint apply] Add PR-only pre-commit workflow & lint all#166
C-Achard wants to merge 7 commits intocy/linter-cifrom
cy/linter-ci-apply

Conversation

@C-Achard
Copy link
Collaborator

@C-Achard C-Achard commented Feb 19, 2026

Add .github/workflows/format.yml

GitHub Actions workflow that runs pre-commit only for changed files in PRs.
It triggers on pull_request (opened, synchronize, reopened), uses a detect_changes job to checkout full history and compute the list of files changed against the base branch, and exposes that list as an output.

A precommit job (guarded by a condition that changed files exist) checks out the PR branch, sets up Python 3.12, installs pre-commit, and runs pre-commit only on the changed files.

@C-Achard C-Achard self-assigned this Feb 19, 2026
@C-Achard C-Achard added the CI Related to the CI / workflows label Feb 19, 2026
Add default_stages and explicitly set stages for hooks so checks that don't modify files can run in both pre-commit and manual/CI, while modifiers run only locally. Reorganize and document ruff hooks into local autofix/write entries (runs with --fix/unsafe-fixes and format write) and CI check-only entries (output-format=github, --check/--diff). Also set stages for pyproject-fmt and validate-pyproject, add check-* hooks to pre-commit/manual, and clarify behavior with inline comments.
Add .github/workflows/format.yml: a GitHub Actions workflow that runs pre-commit only for changed files in PRs. It triggers on pull_request (opened, synchronize, reopened), uses a detect_changes job to checkout full history and compute the list of files changed against the base branch, and exposes that list as an output. A precommit job (guarded by a condition that changed files exist) checks out the PR branch, sets up Python 3.12, installs pre-commit, and runs pre-commit only on the changed files.
Manual fixes:
- Reordered some __init__ calls and added some __all__
- Added tensorrt import best-effort in one file
- __init__.py ignores E402 due to requiring registry update
Replace the single-line echo that wrote CHANGED_FILES to $GITHUB_OUTPUT with a here-document (key<<EOF ... EOF) to correctly export multi-line file lists. This preserves newlines and spaces in the changed-files output so downstream workflow steps receive the full list.
@C-Achard C-Achard changed the title [lint apply] Add PR-only pre-commit workflow [lint apply] Add PR-only pre-commit workflow & lint all Feb 19, 2026
@C-Achard C-Achard changed the base branch from cy/linter-ci to main February 19, 2026 19:40
@C-Achard C-Achard changed the base branch from main to cy/linter-ci February 19, 2026 19:41
fix = true
[tool.ruff.lint]
select = [ "E", "F", "B", "I", "UP" ]
ignore = [ "E741", "E501", "F403", "F401" ]
Copy link
Collaborator

Choose a reason for hiding this comment

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

no F401 or E501? those are some of the main guys!

@sneakers-the-rat
Copy link
Collaborator

It's beautiful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Related to the CI / workflows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments