Skip to content

Commit

Permalink
add spelling check
Browse files Browse the repository at this point in the history
  • Loading branch information
gardner48 committed Jul 15, 2024
1 parent eb010a0 commit a4e353c
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/check-spelling.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Checks - spelling

on:
pull_request:
workflow_dispatch:
push:

jobs:
spelling_check:
runs-on: ubuntu-latest
steps:
- name: Install python3
run: |
apt update
apt install -y --no-install-recommends python3-pip
- name: Install codespell
run: pip install codespell

- name: Print codespell version
run: codespell --version

- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: true

- name: Run codespell
run: |
./scripts/spelling.sh
- name: Run git diff to see if anything changed
run: /usr/bin/git diff --name-only --exit-code

- name: Run git diff if we failed
if: failure()
run: /usr/bin/git diff > spelling.patch

- name: Archive diff as a patch if we failed
uses: actions/upload-artifact@v3
if: failure()
with:
name: spelling.patch
path: |
${{ github.workspace }}/spelling.patch
19 changes: 19 additions & 0 deletions scripts/spelling.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# ---------------------------------------------------------------------------------
# SUNDIALS Copyright Start
# Copyright (c) 2002-2024, Lawrence Livermore National Security
# and Southern Methodist University.
# All rights reserved.
#
# See the top-level LICENSE and NOTICE files for details.
#
# SPDX-License-Identifier: BSD-3-Clause
# SUNDIALS Copyright End
# ---------------------------------------------------------------------------------
# This script will use codespell to check for common misspellings
# ---------------------------------------------------------------------------------

codespell \
--skip="*.git,*.bib,*.eps,*.pdf,*/fmod_int*,*/_themes" \
-L "inout,ans" \
--write-changes

0 comments on commit a4e353c

Please sign in to comment.