Skip to content

Commit

Permalink
Add codespell action
Browse files Browse the repository at this point in the history
  • Loading branch information
ehennestad committed Nov 19, 2024
1 parent 685861e commit 34be617
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/run_codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Note: This workflow allows specifying a custom location for the Codespell
# configuration file by defining CONFIG_FILE as an environment variable.
# A defined subset of options is extracted from this file and passed to the
# Codespell action. This also ensures that the output of the codespell action
# prints out the values of these options.
# Todo: Generalize the extraction of codespell input arguments/options.

name: Codespell

on:
pull_request:
branches:
- main
push:
branches:
- main
- add/developer-tools

jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
env:
CONFIG_FILE: tools/.codespellrc

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Extract codespell configurations from configuration file
id: config
run: |
# Extract 'skip' value from the config file, excluding 'skip = ' part
skip=$(grep -E '^skip' "$CONFIG_FILE" | sed 's/^skip *= *//')
# Extract 'ignore-words-list' value from the config file, excluding 'ignore-words-list = ' part
ignore_words=$(grep -E '^ignore-words-list' "$CONFIG_FILE" | sed 's/^ignore-words-list *= *//')
# Export values as environment variables
echo "SKIP=$skip" >> $GITHUB_ENV
echo "IGNORE_WORDS_LIST=$ignore_words" >> $GITHUB_ENV
- name: Codespell
uses: codespell-project/actions-codespell@v2
with:
skip: "${{ env.SKIP }}"
ignore_words_list: "${{ env.IGNORE_WORDS_LIST }}"
3 changes: 3 additions & 0 deletions tools/.codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[codespell]
skip = *.prj,*/code/+om/+external/**/*.m,*/code/external/*
ignore-words-list = hAx,hTmp,quicky,dataS,whos,siz,strIn,nd,mis,Mis,pixelX,listIn,assignin,doubleclick,ans

0 comments on commit 34be617

Please sign in to comment.