Add pre-commit auto-update workflow - #8
Merged
Conversation
Add pre-commit auto-update workflow by copying changes from equivalent zppy-interfaces PR: https://github.com/E3SM-Project/zppy-interfaces/pull/57/changes
Collaborator
Author
|
Using this branch as-is, I'm unable to build a conda env: rm -rf build
conda clean --all --y
conda env create -f conda/dev.yml -n e3sm-comms-pre-commit-20260813
# CondaError: Cannot link a source that does not exist. |
There was a problem hiding this comment.
Pull request overview
Adds automation to keep QA tooling versions consistent across .pre-commit-config.yaml, conda/dev.yml, and the qa extra in pyproject.toml, and introduces a scheduled GitHub Actions workflow to run pre-commit-update and open an auto-update PR.
Changes:
- Add
scripts/sync_pre_commit_versions.pyto propagate pre-commit hookrevbumps intoconda/dev.ymlandpyproject.toml(qaextra). - Introduce a scheduled/manual GitHub Actions workflow to run
pre-commit-update, sync versions, push a branch, and open a PR. - Minor config/documentation updates, including adding
types-PyYAMLfor themypypre-commit hook.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
scripts/sync_pre_commit_versions.py |
New script to sync pinned tool versions from .pre-commit-config.yaml into other dependency definitions. |
pyproject.toml |
Adds a note pointing to the sync script for keeping qa deps aligned. |
conda/dev.yml |
Updates instructions to use the sync script after pre-commit autoupdate. |
.pre-commit-config.yaml |
Adds a note about syncing and adds types-PyYAML to mypy hook deps. |
.github/workflows/pre_commit_update_workflow.yml |
New scheduled workflow to auto-update pre-commit hooks and open a PR. |
Suppressed comments (2)
.github/workflows/pre_commit_update_workflow.yml:90
gh pr createwill fail the workflow if a PR forupdate-pre-commit-depsalready exists (common when a previous auto-update PR is still open). Add a guard to skip creation (or edit the existing PR) when one already exists so scheduled runs don’t fail noisily.
gh pr create \
--title "Update pre-commit and its dependencies" \
--body "This PR was auto-generated to update pre-commit and its dependencies." \
--head update-pre-commit-deps \
--reviewer ${{ env.REVIEWERS }} \
.github/workflows/pre_commit_update_workflow.yml:57
- This step clones the repository again via HTTPS without pinning a ref/SHA, which ignores the ref checked out by
actions/checkoutand will always use the default branch (especially surprising forworkflow_dispatchruns on non-default refs). It’s also redundant work. Prefer operating on the already checked-out workspace (or check out intoupdate-pre-commit-depsviaactions/checkoutwithpath:/ref:) and adjust the laterdirectory:/cdusages accordingly.
git clone https://github.com/E3SM-Project/e3sm-comms.git update-pre-commit-deps
cd update-pre-commit-deps
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
xylar
reviewed
Aug 14, 2026
Collaborator
Author
|
Confirmed I could create a conda env and pre-commit passes in it. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add pre-commit auto-update workflow by copying changes from equivalent zppy-interfaces PR:
E3SM-Project/zppy-interfaces#57. Other equivalent PRs: E3SM-Project/zppy#853, E3SM-Project/zstash#454