Skip to content

[Feat] Use pre-commit.ci workflow #3255

@nilason

Description

@nilason

Is your feature request related to a problem? Please describe.

It is obvious that not everyone/everything(!) is using pre-commit, which is OK as it was never a requirement. We have been aware of the discrepancies between the checks of pre-commit (as per the config file) and the checks we use in CI (in particular the super-linter). Unsurprisingly, this have now lead to issues to update some files without making unrelated changes (because pre-commit will not allow it). I recently experienced it first-hand making changes to a yaml file with modifications made by Renovate bot update.

Describe the solution you'd like

This situation can be mitigated by using pre-commit.ci for this repository.

For this to work the following pull requests need to be merged:

To then enable pre-commit.ci on this repo, an admin with enough access rights, need to sign into GitHub via https://pre-commit.ci and give it repository access. That's all there is to do. The config file .pre-commit-config.yaml does the rest.

Now, how does this work in real life?

Every commit is checked by pre-commit.ci as if pre-commit were executed locally: the hooks that are formatters, e.g. 'trailing-whitespace', 'black', clang-format' actually do the format and the changed files are added with a new commit to the PR. The other hooks only fails the workflow.
As we always squash the PRs, the automatically added commit do not matter much for the commit history of main. But the commit need to be pulled before adding any additional commits by the PR submitter. This is the main "drawback" with this, but as long as we are aware of this it may be acceptable.

You can see how it works/look like in my test-field at nilason#5.

Describe alternatives you've considered

There are no good alternatives that come to my mind.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CIContinuous integrationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions