diff --git a/docs/pages/guides/gha_basic.md b/docs/pages/guides/gha_basic.md index 387c7c36..a161cd96 100644 --- a/docs/pages/guides/gha_basic.md +++ b/docs/pages/guides/gha_basic.md @@ -53,13 +53,28 @@ you use a develop branch, you probably will want to include that. You can also specify specific branches for pull requests instead of running on all PRs (will run on PRs targeting those branches only). -## Pre-commit +## Prek / Pre-commit -If you use [pre-commit](https://pre-commit.com) (and you should), and you don't -want to / can't use [pre-commit.ci](https://pre-commit.ci) yet, then this is a -job that will check pre-commit for you: +If you use [prek][] or [pre-commit][] in CI, you can run it directly in GitHub +Actions. Prek is a faster Rust rewrite of pre-commit that supports most real +world usage and supports the same configuration and hooks. -{% raw %} +{% tabs runner %} {% tab prek Prek %} + +Prek can run using the official action: + +```yaml +lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: j178/prek-action@v2 +``` + +{% endtab %} {% tab pre-commit Pre-commit %} + +Pre-commit can run using the official action: ```yaml lint: @@ -73,7 +88,7 @@ lint: - uses: pre-commit/action@v3.0.1 ``` -{% endraw %} +{% endtab %} {% endtabs %} If you do use [pre-commit.ci](https://pre-commit.ci), but you need this job to run a manual check, like check-manifest, then you can keep it but just use @@ -757,6 +772,10 @@ changelog: -[gh-changelog]: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes +[pre-commit]: https://pre-commit.com +[prek]: https://github.com/j178/prek +[gh-changelog]: https://docs.github.com/en/repositories/releasing-projects + + diff --git a/docs/pages/guides/style.md b/docs/pages/guides/style.md index 069be561..f4025896 100644 --- a/docs/pages/guides/style.md +++ b/docs/pages/guides/style.md @@ -17,7 +17,15 @@ custom_title: Style and static checks to check code style. The original, `pre-commit`, has support for more languages, but `prek` is a faster Rust rewrite that supports most real world usage. -{% tabs runner %} {% tab pre-commit Pre-commit %} +{% tabs runner %} {% tab prek Prek %} + +Prek can be installed through `brew` (macOS) or `pipx/uv` (anywhere). There are +two modes to use it locally; you can check manually with `prek run` (changes +only) or `prek run -a` (all). You can omit the `run`, as well; such as +`prek -a`. You can also run `prek install` to add checks as a git pre-commit +hook. + +{% endtab %} {% tab pre-commit Pre-commit %} Pre-commit can be installed through `brew` (macOS) or `pipx/uv` (anywhere). There are two modes to use it locally; you can check manually with @@ -28,14 +36,6 @@ gets its name). Pre-commit's setup is much slower than prek, but you can install `pre-commit-uv` with pre-commit to speed up the setup time quite a bit. -{% endtab %} {% tab prek Prek %} - -Prek can be installed through `brew` (macOS) or `pipx/uv` (anywhere). There are -two modes to use it locally; you can check manually with `prek run` (hanges -only) or `prek run -a` (all). You can omit the `run`, as well; such as -`prek -a`. You can also run `prek install` to add checks as a git pre-commit -hook. - {% endtab %} {% endtabs %} Local runs (with `-a`) are the standard way to use it. That will run all the @@ -47,8 +47,6 @@ a custom pre-commit hook before; it's quite elegant and does not add or commit the changes, it just makes the changes and allows you to check and add them. You can always override the hook with `-n`. -[pre-commit]: https://pre-commit.com - {% rr PC100 %} Here is a minimal `.pre-commit-config.yaml` file with some handy options: @@ -1047,6 +1045,8 @@ You also might like the following hook, which cleans Jupyter outputs: [schemastore]: https://schemastore.org [typos]: https://github.com/crate-ci/typos [typos-ref]: https://github.com/crate-ci/typos/blob/master/docs/reference.md +[pre-commit]: https://pre-commit.com +[prek]: https://prek.j178.dev