ci: check for typos in the source tree

This commit is contained in:
NotAShelf 2024-11-26 11:20:34 +03:00
parent f86f8bb9dc
commit 0e14e8008b
No known key found for this signature in database
GPG key ID: AF26552424E53993
3 changed files with 33 additions and 1 deletions

2
.github/typos.toml vendored Normal file
View file

@ -0,0 +1,2 @@
default.extend-ignore-words-re = ["(?i)(noice)", "befores", "annote"]

View file

@ -15,7 +15,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api \
repos/notashelf/neovim-flake/pulls/${{github.event.number}}/files --paginate \
repos/notashelf/nvf/pulls/${{github.event.number}}/files --paginate \
| jq '.[] | select(.status != "removed") | .filename' \
> "$HOME/changed_files"

30
.github/workflows/typos.yml vendored Normal file
View file

@ -0,0 +1,30 @@
name: "Check for typos in the source tree"
permissions: read-all
on:
pull_request:
workflow_dispatch:
push:
jobs:
check-typos:
runs-on: ubuntu-latest
if: "!contains(github.event.pull_request.title, '[skip ci]')"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check for typos
uses: crate-ci/typos@master
with:
config: .github/typos.toml
- name: Fail Gracefully
if: ${{ failure() }}
shell: bash
run: |
echo "::error:: Current codebase contains typos that were caught by the CI!"
echo "If those typos were intentional, please add them to the ignored regexes in .github/typos.toml"
echo "[skip ci] label may be used if this is a one-time issue"
exit 1