Skip to content

Add pre-commit auto-update workflow - #8

Merged
forsyth2 merged 2 commits into
mainfrom
add-pre-commit-update-workflow
Aug 14, 2026
Merged

Add pre-commit auto-update workflow#8
forsyth2 merged 2 commits into
mainfrom
add-pre-commit-update-workflow

Conversation

@forsyth2

Copy link
Copy Markdown
Collaborator

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

Add pre-commit auto-update workflow by copying changes from
equivalent zppy-interfaces PR:
https://github.com/E3SM-Project/zppy-interfaces/pull/57/changes
@forsyth2 forsyth2 self-assigned this Aug 14, 2026
@forsyth2

Copy link
Copy Markdown
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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.py to propagate pre-commit hook rev bumps into conda/dev.yml and pyproject.toml (qa extra).
  • 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-PyYAML for the mypy pre-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 create will fail the workflow if a PR for update-pre-commit-deps already 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/checkout and will always use the default branch (especially surprising for workflow_dispatch runs on non-default refs). It’s also redundant work. Prefer operating on the already checked-out workspace (or check out into update-pre-commit-deps via actions/checkout with path:/ref:) and adjust the later directory:/cd usages 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.

Comment thread .github/workflows/pre_commit_update_workflow.yml Outdated
Comment thread scripts/sync_pre_commit_versions.py Outdated

@xylar xylar left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A few things like in the others.

Comment thread .github/workflows/pre_commit_update_workflow.yml Outdated
Comment thread .github/workflows/pre_commit_update_workflow.yml Outdated
Comment thread pyproject.toml
Comment thread conda/dev.yml
@forsyth2

Copy link
Copy Markdown
Collaborator Author

Confirmed I could create a conda env and pre-commit passes in it.

@forsyth2
forsyth2 merged commit 2fddee0 into main Aug 14, 2026
@forsyth2
forsyth2 deleted the add-pre-commit-update-workflow branch August 14, 2026 18:53
@forsyth2 forsyth2 added the DevOps CI/CD, configuration, etc. label Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DevOps CI/CD, configuration, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants