diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..46588cc1 --- /dev/null +++ b/.codespellrc @@ -0,0 +1,8 @@ +# 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 = afterall +builtin = clear,informal,en-GB_to_en-US +check-filenames = +check-hidden = +skip = ./.git,./dist,./package-lock.json,./poetry.lock diff --git a/.github/workflows/spell-check-task.yml b/.github/workflows/spell-check-task.yml new file mode 100644 index 00000000..07736b1e --- /dev/null +++ b/.github/workflows/spell-check-task.yml @@ -0,0 +1,36 @@ +name: Spell Check + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + 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: + spellcheck: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install Python + uses: actions/setup-python@v2 + with: + python-version: "3.9" + + - name: Install Poetry + run: pip install poetry + + - name: Install Task + uses: arduino/actions/setup-taskfile@master + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + version: 3.x + + - name: Spell check + run: task general:check-spelling diff --git a/README.md b/README.md index 1f24cbe9..1a8b23b5 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Integration Tests status](https://github.com/arduino/setup-taskfile/actions/workflows/test-integration.yml/badge.svg)](https://github.com/arduino/setup-taskfile/actions/workflows/test-integration.yml) [![Check Action Metadata status](https://github.com/arduino/setup-taskfile/actions/workflows/check-action-metadata-task.yml/badge.svg)](https://github.com/arduino/setup-taskfile/actions/workflows/check-action-metadata-task.yml) +[![Spell Check status](https://github.com/arduino/setup-taskfile/actions/workflows/spell-check.yml/badge.svg)](https://github.com/arduino/setup-taskfile/actions/workflows/spell-check.yml) [![Check License status](https://github.com/arduino/setup-taskfile/actions/workflows/check-license.yml/badge.svg)](https://github.com/arduino/setup-taskfile/actions/workflows/check-license.yml) This action makes the `task` binary available to Workflows. diff --git a/Taskfile.yml b/Taskfile.yml index ad2efc36..a14b000c 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -14,3 +14,15 @@ tasks: cmds: - wget --output-document={{ .ACTION_METADATA_SCHEMA_PATH }} https://json.schemastore.org/github-action - npx ajv-cli validate --strict=false -s {{ .ACTION_METADATA_SCHEMA_PATH }} -d "action.yml" + + general:check-spelling: + desc: Check for commonly misspelled words + cmds: + - poetry install --no-root + - poetry run codespell + + general:correct-spelling: + desc: Correct commonly misspelled words where possible + cmds: + - poetry install --no-root + - poetry run codespell --write-changes diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 00000000..c4b22ecd --- /dev/null +++ b/poetry.lock @@ -0,0 +1,22 @@ +[[package]] +category = "dev" +description = "Codespell" +name = "codespell" +optional = false +python-versions = ">=3.5" +version = "2.0.0" + +[package.extras] +dev = ["check-manifest", "flake8", "pytest", "pytest-cov", "pytest-dependency"] +hard-encoding-detection = ["chardet"] + +[metadata] +content-hash = "27fdeda232f6317a01e4d74e683463ea60641c751d7f656bef36d8fee849adb8" +lock-version = "1.0" +python-versions = "^3.9" + +[metadata.files] +codespell = [ + {file = "codespell-2.0.0-py3-none-any.whl", hash = "sha256:a10b8bbb9f678e4edff7877af1f654fdc9e27c205f952c3ddee2981ad02ec5f2"}, + {file = "codespell-2.0.0.tar.gz", hash = "sha256:dd9983e096b9f7ba89dd2d2466d1fc37231d060f19066331b9571341363c77b8"}, +] diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..e32c5cb1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,11 @@ +[tool.poetry] +name = "setup-taskfile" +version = "0.0.0" +description = "GitHub Actions action to install Task" +authors = ["Arduino "] + +[tool.poetry.dependencies] +python = "^3.9" + +[tool.poetry.dev-dependencies] +codespell = ">=2.0.0"