-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CI workflow to check for commonly misspelled words
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.
- Loading branch information
Showing
4 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check/.codespellrc | ||
# See: https://github.com/codespell-project/codespell#using-a-config-file | ||
[codespell] | ||
# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: | ||
ignore-words-list = , | ||
skip = ./.git,./.licenses,__pycache__,node_modules,./go.mod,./go.sum,./package-lock.json,./poetry.lock,./yarn.lock | ||
builtin = clear,informal,en-GB_to_en-US | ||
check-filenames = | ||
check-hidden = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/spell-check-task.md | ||
name: Spell Check | ||
|
||
env: | ||
# See: https://github.com/actions/setup-python/tree/main#available-versions-of-python | ||
PYTHON_VERSION: "3.9" | ||
|
||
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows | ||
on: | ||
create: | ||
push: | ||
pull_request: | ||
schedule: | ||
# Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates. | ||
- cron: "0 8 * * TUE" | ||
workflow_dispatch: | ||
repository_dispatch: | ||
|
||
jobs: | ||
run-determination: | ||
runs-on: ubuntu-latest | ||
permissions: {} | ||
outputs: | ||
result: ${{ steps.determination.outputs.result }} | ||
steps: | ||
- name: Determine if the rest of the workflow should run | ||
id: determination | ||
run: | | ||
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x" | ||
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead. | ||
if [[ | ||
"${{ github.event_name }}" != "create" || | ||
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX | ||
]]; then | ||
# Run the other jobs. | ||
RESULT="true" | ||
else | ||
# There is no need to run the other jobs. | ||
RESULT="false" | ||
fi | ||
echo "result=$RESULT" >> $GITHUB_OUTPUT | ||
spellcheck: | ||
needs: run-determination | ||
if: needs.run-determination.outputs.result == 'true' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
|
||
- name: Install Poetry | ||
run: pip install poetry | ||
|
||
- name: Install Task | ||
uses: arduino/setup-task@v1 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
version: 3.x | ||
|
||
- name: Spell check | ||
run: task general:check-spelling |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# See: https://taskfile.dev/#/usage | ||
version: "3" | ||
|
||
tasks: | ||
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml | ||
poetry:install-deps: | ||
desc: Install dependencies managed by Poetry | ||
cmds: | ||
- poetry install --no-root | ||
|
||
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/poetry-task/Taskfile.yml | ||
poetry:update-deps: | ||
desc: Update all dependencies managed by Poetry to their newest versions | ||
cmds: | ||
- poetry update | ||
|
||
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml | ||
general:check-spelling: | ||
desc: Check for commonly misspelled words | ||
deps: | ||
- task: poetry:install-deps | ||
cmds: | ||
- poetry run codespell | ||
|
||
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/spell-check-task/Taskfile.yml | ||
general:correct-spelling: | ||
desc: Correct commonly misspelled words where possible | ||
deps: | ||
- task: poetry:install-deps | ||
cmds: | ||
- poetry run codespell --write-changes |