[CI] Create reusable pre-commit workflows#12836
[CI] Create reusable pre-commit workflows#12836jbampton wants to merge 5 commits intoapache:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12836 +/- ##
============================================
- Coverage 18.02% 18.01% -0.01%
Complexity 16464 16464
============================================
Files 5973 5973
Lines 537466 537466
Branches 65991 65991
============================================
- Hits 96853 96834 -19
- Misses 429690 429711 +21
+ Partials 10923 10921 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
There was a problem hiding this comment.
Pull request overview
This PR restructures the repository’s pre-commit GitHub Actions setup by extracting the shared steps into a reusable workflow, enabling separate CI runs for different pre-commit hook stages, and updates the README badge to point at the new workflow.
Changes:
- Refactor the existing pre-commit workflow to call a new reusable workflow.
- Add a second workflow to run the “manual” pre-commit hook stage separately on PRs.
- Update the README “Linter Status” badge link to the pre-commit workflow.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| README.md | Updates the linter badge to reference the pre-commit workflow. |
| .github/workflows/pre-commit.yml | Converts the standard pre-commit run to use the reusable workflow. |
| .github/workflows/pre-commit-reusable.yml | Introduces the reusable workflow that installs dependencies, configures cache, and runs pre-commit with optional extra args. |
| .github/workflows/pre-commit-manual.yml | Adds a separate PR workflow to run manual-stage pre-commit hooks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| name: pre-commit | ||
|
|
||
| on: [pull_request] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
|
|
There was a problem hiding this comment.
Both pre-commit.yml and this new workflow set name: pre-commit and use concurrency.group: ${{ github.workflow }}-.... Since github.workflow is the workflow name, these two workflows will share the same concurrency group and end up cancelling each other (because cancel-in-progress: true), which defeats the goal of having separate checks. Make the workflow names and/or concurrency group strings distinct (e.g., hardcode different group prefixes per workflow file).
|
|
||
| jobs: | ||
| run-hooks: | ||
| runs-on: ubuntu-latest |
There was a problem hiding this comment.
runs-on: ubuntu-latest can change over time as GitHub updates the default runner image, which can introduce unexpected CI breakages (especially for linting/tooling workflows). Consider pinning to a specific Ubuntu version (e.g., ubuntu-22.04 or ubuntu-24.04) to keep pre-commit results reproducible.
| runs-on: ubuntu-latest | |
| runs-on: ubuntu-22.04 |
Description
This PR...
Separates the jobs run commands and arguments by reuse.
Gives us two jobs on the PR page when a PR is opened.
Quickly shows us what is failing by separation.
More jobs can be easily added.
Fixes a readme badge link
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?