[CI] Add `isort` and cancel on concurrency
Description
- Commit 806448592bb2d6ab867154665d1613f8f88f664d adds
isortand move black and isort configs topyproject.toml. - Commit 94385e2c573ea1b7fb4daf1e2be1bb8c8174ddbe add cancellation on concurrency to CI jobs to save CI resources.
Type of change
- [ ] Documentation change (change only to the documentation, either a fix or a new content)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [x] Infra/Build change
- [ ] Code refactoring
Changes
Please list the changes introduced in this PR:
- Change A
- Change B
Checklist:
- [ ] I have read and followed the contributing guidelines
- [ ] The functionality is complete
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
Greptile Overview
Greptile Summary
This PR adds two infrastructure improvements: (1) isort integration for Python import sorting with configuration centralized in pyproject.toml alongside existing black settings, and (2) concurrency controls to automatically cancel outdated CI workflow runs when new commits are pushed to PRs, saving CI resources.
Key changes:
- Added
isortpre-commit hook withprofile="black"for compatibility - Moved
blackconfiguration from command-line args topyproject.toml - Added concurrency groups to all three main workflows (
build.yml,docs.yml,lint.yml) to cancel in-progress runs when superseded
The docs.yml workflow is also triggered via workflow_call from deploy_nightly_docs.yml on pushes to main. In those cases, github.event.pull_request.number will be empty, so the concurrency group falls back to github.ref, which still provides appropriate grouping behavior for main branch pushes.
Confidence Score: 5/5
- This PR is safe to merge with no blocking issues
- The changes are low-risk infrastructure improvements: adding import sorting tooling and workflow concurrency controls. All configurations are compatible (isort profile=black), and the concurrency grouping pattern is standard for GitHub Actions. The fallback behavior when github.event.pull_request.number is empty works correctly.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| .github/workflows/docs.yml | 4/5 | Added concurrency cancellation; may need adjustment for workflow_call trigger from deploy_nightly_docs |
| .pre-commit-config.yaml | 5/5 | Moved black args to pyproject.toml and added isort hook for import sorting |
| pyproject.toml | 5/5 | Added black and isort configurations with compatible settings (profile=black, line_length=100) |
Sequence Diagram
sequenceDiagram
participant Dev as Developer
participant GH as GitHub
participant Pre as Pre-commit Hooks
participant CI as CI Workflows
Dev->>Pre: git commit
Pre->>Pre: Run black formatter
Pre->>Pre: Run isort (import sorting)
Pre->>Pre: Run other hooks
Pre-->>Dev: Commit successful
Dev->>GH: git push (new commit to PR)
GH->>CI: Trigger workflows (build, lint, docs)
Note over CI: Concurrency group checks
CI->>CI: Cancel previous in-progress runs<br/>for same PR/workflow
CI->>CI: Run new workflow instances
CI-->>GH: Report results