Skip to content

[CI] Create reusable pre-commit workflows - #12836

Draft
jbampton wants to merge 5 commits into
apache:mainfrom
jbampton:pre-commit-reusable-workflows
Draft

[CI] Create reusable pre-commit workflows#12836
jbampton wants to merge 5 commits into
apache:mainfrom
jbampton:pre-commit-reusable-workflows

Conversation

@jbampton

Copy link
Copy Markdown
Member

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

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

@codecov

codecov Bot commented Mar 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 18.01%. Comparing base (7eea9ed) to head (110f207).
⚠️ Report is 344 commits behind head on main.

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     
Flag Coverage Δ
uitests 3.52% <ø> (ø)
unittests 19.18% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines +18 to +27
name: pre-commit

on: [pull_request]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}

Copilot AI Mar 31, 2026

Copy link

Choose a reason for hiding this comment

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

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).

Copilot uses AI. Check for mistakes.

jobs:
run-hooks:
runs-on: ubuntu-latest

Copilot AI Mar 31, 2026

Copy link

Choose a reason for hiding this comment

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

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.

Suggested change
runs-on: ubuntu-latest
runs-on: ubuntu-22.04

Copilot uses AI. Check for mistakes.

@DaanHoogland DaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@github-actions

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@weizhouapache weizhouapache added this to the 4.24.0 milestone Jun 29, 2026
@DaanHoogland DaanHoogland moved this from Backlog to conflict/waiting for author in CloudStack Testing Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: conflict/waiting

Development

Successfully merging this pull request may close these issues.

4 participants