Add pre-commit.ci configurations to enable auto updates of hooks#3414
Add pre-commit.ci configurations to enable auto updates of hooks#3414
Conversation
.github/workflows/style_checks.yaml
Outdated
|
|
||
| - name: Check updates of pre-commit hooks | ||
| run: | | ||
| pre-commit autoupdate |
There was a problem hiding this comment.
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.
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.
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.
I'm OK with enabling pre-commit.ci for auto update.
There was a problem hiding this comment.
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.
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 autoupdatecommand 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).