-
Notifications
You must be signed in to change notification settings - Fork 224
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
Add pre-commit.ci configurations to enable auto updates of hooks #3414
Conversation
.github/workflows/style_checks.yaml
Outdated
@@ -37,6 +37,11 @@ jobs: | |||
python -m pip install ruff pre-commit | |||
python -m pip list | |||
|
|||
- name: Check updates of pre-commit hooks | |||
run: | | |||
pre-commit autoupdate |
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.
Maybe run the autoupdate line only on cron jobs? So that PRs don't get slowed down by sudden Style Check changes.
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.
OK. I've added the if-condition so that the autoupdate command only runs on schedule or workflow_dispatch events. It means we have to check https://github.com/GenericMappingTools/pygmt/actions/workflows/style_checks.yaml to know if there are new versions for hooks. Maybe we should automatically open a PR if there are updates?
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.
Maybe we should automatically open a PR if there are updates?
Maybe we could just use pre-commit.ci as was tried in #3283? The automation would require quite a bit of code to set up. Ideally we could use dependabot but looking at dependabot/dependabot-core#1524, it's still not working yet.
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'm OK with enabling pre-commit.ci for auto update.
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.
Ok, add these lines to .pre-commit-config.yaml
:
# https://pre-commit.ci/#configuration
ci:
autofix_prs: false
autoupdate_schedule: quarterly
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.
The pre-commit.ci App is also installed https://github.com/GenericMappingTools/pygmt/settings/installations.
pre-commit.ci fails in the main branch https://results.pre-commit.ci/run/github/85352251/1724751409.rGgeqA4fQ22hZH-xAZG-Nw, as mentioned in #3283 (comment). It seems we can't change how files are cloned in pre-commit.ci and also can't disable pre-commit.ci in the main branch. I guess the only option is removing the |
Description of proposed changes
Run
pre-commit autoupdate
command in the Style Checks workflow, to check if there are new versions of pre-commit hooks. The workflow will fail if there are updates. Then we just need to open a PR to manually update the workflow.Address #3374 (comment).