Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .config/mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[tools]
dprint = "0.47.6"
lefthook = "latest"
shellcheck = "0.10.0"
shfmt = "3.10"
10 changes: 3 additions & 7 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# No caching as we're expected to run rarely
- name: Install dependencies and run checks
- uses: jdx/mise-action@5bb8f8c1911837cf42064e6490e7634fc842ee7e # v2.1.8
- name: Run checks
env:
FORCE_COLOR: true
LEFTHOOK_QUIET: meta,execution
WRUN_VERBOSE: true
run: |
set -euxo pipefail
python3 -m pip install --no-cache-dir wrun-py
npm exec --yes -- lefthook run pre-commit --all-files --force --no-tty
run: lefthook run pre-commit --all-files --force --no-tty
10 changes: 2 additions & 8 deletions .github/workflows/update-tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: jdx/mise-action@5bb8f8c1911837cf42064e6490e7634fc842ee7e # v2.1.8
- name: Check for and prepare updates
env:
FORCE_COLOR: true
LEFTHOOK_QUIET: meta,execution
WRUN_VERBOSE: true
run: |
set -euxo pipefail
python3 -m pip install --no-cache-dir wrun-py
npm exec --yes -- lefthook run update-tools
run: mise upgrade --bump
- uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5
with:
token: ${{ secrets.TOOLS_UPDATE_TOKEN }}
Expand Down
21 changes: 3 additions & 18 deletions .lefthook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,15 @@ pre-commit:
jobs:
- name: dprint
glob: "*.{json,jsonc,md,yaml}"
env:
WRUN_ARGS_FILE: .lefthook/wrun-args-dprint.txt
run: wrun -- fmt {staged_files}
run: mise exec -- dprint fmt {staged_files}
- name: shell-tools
glob: vault-token-helper-secret-tool
group:
jobs:
- name: shfmt
env:
WRUN_ARGS_FILE: .lefthook/wrun-args-shfmt.txt
run: wrun -- --write --simplify {staged_files}
run: mise exec -- shfmt --write --simplify {staged_files}
- name: shellcheck
env:
WRUN_ARGS_FILE: .lefthook/wrun-args-shellcheck.txt
run: wrun -- --format=gcc {staged_files}
run: mise exec -- shellcheck --format=gcc {staged_files}
- name: hook-made-changes
run: |-
if test -n "${CI-}"; then
Expand All @@ -31,12 +25,3 @@ pre-commit:
rc=$?
test $rc -eq 0 || echo "error: found files modified by hooks" >&2
exit $rc

update-tools:
commands:
dprint:
run: wrun generate github dprint >.lefthook/wrun-args-dprint.txt
shellcheck:
run: wrun generate shellcheck >.lefthook/wrun-args-shellcheck.txt
shfmt:
run: wrun generate github mvdan sh --tool shfmt >.lefthook/wrun-args-shfmt.txt
6 changes: 0 additions & 6 deletions .lefthook/wrun-args-dprint.txt

This file was deleted.

13 changes: 0 additions & 13 deletions .lefthook/wrun-args-shellcheck.txt

This file was deleted.

8 changes: 0 additions & 8 deletions .lefthook/wrun-args-shfmt.txt

This file was deleted.

Loading