Skip to content

Commit 7d6bd57

Browse files
committed
docs: add prek tabs to GitHub Actions docs
- Add tabs for prek and pre-commit in gha_basic.md with prek first - Reorder tabs in style.md to put prek before pre-commit - Add link definitions for pre-commit and prek - Add tabs.js script to gha_basic.md - Fix typo in style.md (hanges -> changes) Assisted-by: opencode:qwen3
1 parent db46775 commit 7d6bd57

2 files changed

Lines changed: 32 additions & 15 deletions

File tree

docs/pages/guides/gha_basic.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,24 @@ run on PRs targeting those branches only).
5555
5656
## Pre-commit
5757
58-
If you use [pre-commit](https://pre-commit.com) (and you should), and you don't
59-
want to / can't use [pre-commit.ci](https://pre-commit.ci) yet, then this is a
60-
job that will check pre-commit for you:
58+
{% rr PY006 %} If you use [pre-commit][] (or [prek][]) in CI, you can run it
59+
directly in GitHub Actions. Prek is a faster Rust rewrite of pre-commit that
60+
supports most real world usage.
6161
62-
{% raw %}
62+
{% tabs runner %} {% tab prek Prek %}
63+
64+
```yaml
65+
lint:
66+
name: Lint
67+
runs-on: ubuntu-latest
68+
steps:
69+
- uses: actions/checkout@v6
70+
- uses: j178/prek-action@v2
71+
```
72+
73+
{% endtab %} {% tab pre-commit Pre-commit %}
74+
75+
Pre-commit can run using the official action:
6376
6477
```yaml
6578
lint:
@@ -73,7 +86,7 @@ lint:
7386
- uses: pre-commit/action@v3.0.1
7487
```
7588
76-
{% endraw %}
89+
{% endtab %} {% endtabs %}
7790
7891
If you do use [pre-commit.ci](https://pre-commit.ci), but you need this job to
7992
run a manual check, like check-manifest, then you can keep it but just use
@@ -757,6 +770,10 @@ changelog:
757770

758771
<!-- prettier-ignore-start -->
759772

760-
[gh-changelog]: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
773+
[pre-commit]: https://pre-commit.com
774+
[prek]: https://github.com/j178/prek
775+
[gh-changelog]: https://docs.github.com/en/repositories/releasing-projects
761776

762777
<!-- prettier-ignore-end -->
778+
779+
<script src="{% link assets/js/tabs.js %}"></script>

docs/pages/guides/style.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ custom_title: Style and static checks
1717
to check code style. The original, `pre-commit`, has support for more languages,
1818
but `prek` is a faster Rust rewrite that supports most real world usage.
1919

20-
{% tabs runner %} {% tab pre-commit Pre-commit %}
20+
{% tabs runner %} {% tab prek Prek %}
21+
22+
Prek can be installed through `brew` (macOS) or `pipx/uv` (anywhere). There are
23+
two modes to use it locally; you can check manually with `prek run` (changes
24+
only) or `prek run -a` (all). You can omit the `run`, as well; such as
25+
`prek -a`. You can also run `prek install` to add checks as a git pre-commit
26+
hook.
27+
28+
{% endtab %} {% tab pre-commit Pre-commit %}
2129

2230
Pre-commit can be installed through `brew` (macOS) or `pipx/uv` (anywhere).
2331
There are two modes to use it locally; you can check manually with
@@ -28,14 +36,6 @@ gets its name).
2836
Pre-commit's setup is much slower than prek, but you can install `pre-commit-uv`
2937
with pre-commit to speed up the setup time quite a bit.
3038

31-
{% endtab %} {% tab prek Prek %}
32-
33-
Prek can be installed through `brew` (macOS) or `pipx/uv` (anywhere). There are
34-
two modes to use it locally; you can check manually with `prek run` (hanges
35-
only) or `prek run -a` (all). You can omit the `run`, as well; such as
36-
`prek -a`. You can also run `prek install` to add checks as a git pre-commit
37-
hook.
38-
3939
{% endtab %} {% endtabs %}
4040

4141
Local runs (with `-a`) are the standard way to use it. That will run all the

0 commit comments

Comments
 (0)