Skip to content

Commit 3437c72

Browse files
authored
Add CI workflow to check for commonly misspelled words (#20)
On every push, pull request, and periodically, use codespell to check for commonly misspelled words. In the event of a false positive, the problematic word should be added, in all lowercase, to the field of . Regardless of the case of the word in the false positive, it must be in all lowercase in the ignore list. The ignore list is comma-separated with no spaces.
1 parent f9fd31d commit 3437c72

File tree

4 files changed

+113
-1
lines changed

4 files changed

+113
-1
lines changed

.codespellrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check/.codespellrc
2+
# See: https://github.com/codespell-project/codespell#using-a-config-file
3+
[codespell]
4+
# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here:
5+
ignore-words-list = ,
6+
skip = ./.git,./.licenses,__pycache__,node_modules,./go.mod,./go.sum,./package-lock.json,./poetry.lock,./yarn.lock
7+
builtin = clear,informal,en-GB_to_en-US
8+
check-filenames =
9+
check-hidden =
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/spell-check-task.md
2+
name: Spell Check
3+
4+
env:
5+
# See: https://github.com/actions/setup-python/tree/main#available-versions-of-python
6+
PYTHON_VERSION: "3.9"
7+
8+
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
9+
on:
10+
create:
11+
push:
12+
pull_request:
13+
schedule:
14+
# Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates.
15+
- cron: "0 8 * * TUE"
16+
workflow_dispatch:
17+
repository_dispatch:
18+
19+
jobs:
20+
run-determination:
21+
runs-on: ubuntu-latest
22+
permissions: {}
23+
outputs:
24+
result: ${{ steps.determination.outputs.result }}
25+
steps:
26+
- name: Determine if the rest of the workflow should run
27+
id: determination
28+
run: |
29+
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
30+
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
31+
if [[
32+
"${{ github.event_name }}" != "create" ||
33+
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
34+
]]; then
35+
# Run the other jobs.
36+
RESULT="true"
37+
else
38+
# There is no need to run the other jobs.
39+
RESULT="false"
40+
fi
41+
42+
echo "result=$RESULT" >> $GITHUB_OUTPUT
43+
44+
spellcheck:
45+
needs: run-determination
46+
if: needs.run-determination.outputs.result == 'true'
47+
runs-on: ubuntu-latest
48+
permissions:
49+
contents: read
50+
51+
steps:
52+
- name: Checkout repository
53+
uses: actions/checkout@v4
54+
55+
- name: Install Python
56+
uses: actions/setup-python@v5
57+
with:
58+
python-version: ${{ env.PYTHON_VERSION }}
59+
60+
- name: Install Poetry
61+
run: pip install poetry
62+
63+
- name: Install Task
64+
uses: arduino/setup-task@v1
65+
with:
66+
repo-token: ${{ secrets.GITHUB_TOKEN }}
67+
version: 3.x
68+
69+
- name: Spell check
70+
run: task general:check-spelling

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# Arduino_GigaDisplay
1+
Arduino_GigaDisplay
2+
===================
3+
[![Spell Check status](https://github.com/arduino-libraries/Arduino_GigaDisplay/actions/workflows/spell-check-task.yml/badge.svg)](https://github.com/arduino-libraries/Arduino_GigaDisplay/actions/workflows/spell-check-task.yml)
24

35
This library contains a set of examples to use the [GIGA Display Shield](docs.arduino.cc/hardware/giga-display-shield). Upon installing this library from the Arduino IDE, the following libraries will also be installed:
46
- [ArduinoGraphics](https://github.com/arduino-libraries/ArduinoGraphics)

Taskfile.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# See: https://taskfile.dev/#/usage
2+
version: "3"
3+
4+
tasks:
5+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
6+
poetry:install-deps:
7+
desc: Install dependencies managed by Poetry
8+
cmds:
9+
- poetry install --no-root
10+
11+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml
12+
poetry:update-deps:
13+
desc: Update all dependencies managed by Poetry to their newest versions
14+
cmds:
15+
- poetry update
16+
17+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml
18+
general:check-spelling:
19+
desc: Check for commonly misspelled words
20+
deps:
21+
- task: poetry:install-deps
22+
cmds:
23+
- poetry run codespell
24+
25+
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml
26+
general:correct-spelling:
27+
desc: Correct commonly misspelled words where possible
28+
deps:
29+
- task: poetry:install-deps
30+
cmds:
31+
- poetry run codespell --write-changes

0 commit comments

Comments
 (0)