Repository navigation
[no-ci] ci: run pre-commit on Linux and Windows with Dependabot hook updates #2994
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0d80967
ci: add standalone pre-commit checks and quarterly updates
rwgk 85d5fd1
ci: retain manual testing after workflow bootstrap
rwgk 14c955c
ci: use Dependabot for quarterly pre-commit hook updates
rwgk 5a545e0
ci: run pre-commit with Python 3.14
rwgk 7464d45
ci: align Dependabot schedules and bot PR metadata
rwgk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| name: "CI: pre-commit" | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
| push: | ||
| # PR events cover draft and fork PRs without also checking copy-pr-bot's | ||
| # pull-request/N mirrors. Only main needs a push check. | ||
| branches: | ||
| - "main" | ||
| workflow_dispatch: {} | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} | ||
| cancel-in-progress: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash --noprofile --norc -xeuo pipefail {0} | ||
|
|
||
| jobs: | ||
| pre-commit: | ||
| name: Pre-commit (${{ matrix.name }}) | ||
| runs-on: ${{ matrix.os }} | ||
| timeout-minutes: 30 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - name: Linux | ||
| os: ubuntu-latest | ||
| - name: Windows | ||
| os: windows-latest | ||
| env: | ||
| # Link checks have their own Linux workflow. The installation reminder | ||
| # is for developer machines; CI does not install a Git commit hook. | ||
| SKIP: lychee,check-precommit-installed | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| fetch-depth: 1 | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Python | ||
| id: python | ||
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | ||
| with: | ||
| python-version: '3.14' | ||
|
|
||
| - name: Set pre-commit cache location | ||
| run: echo "PRE_COMMIT_HOME=${RUNNER_TEMP}/pre-commit" >> "${GITHUB_ENV}" | ||
|
|
||
| - name: Cache pre-commit environments | ||
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | ||
| with: | ||
| path: ${{ env.PRE_COMMIT_HOME }} | ||
| key: pre-commit-${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }} | ||
|
|
||
| - name: Install pre-commit | ||
| run: python -m pip install --upgrade pip pre-commit | ||
|
|
||
| - name: Run pre-commit | ||
| run: pre-commit run --all-files --show-diff-on-failure | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a specific reason to always upgrade
pip? I think in this clean environment we always get the latest version anyway. (Maybe the caching means it might be stale)?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer to keep the upgrade: it is very quick when pip is already current and removes a doubt.
Rationale:
I asked codex to look a little deeper. It found:
A clean environment doesn't guarantee that it will always be a no-op. With our inputs,
setup-pythonselects a Python installation and doesn't automatically upgrade pip. Python's bundled pip can lag the separately released version on PyPI. The pre-commit cache contains hook environments, rather than the host's pip, so that cache isn't the explanation.codex also explained:
The original workflow kept the pip upgrade from the existing Windows job so that pre-commit is installed with the current pip. There's no demonstrated need for a newer pip today. In the earlier validation run, both Linux and Windows already had pip 26.2.1, so the upgrade was a no-op.