From 1f247fbda9f6427667b3d85ac2beb4f8bc303abd Mon Sep 17 00:00:00 2001 From: sailajakommineni Date: Fri, 17 Nov 2023 04:51:33 +0000 Subject: [PATCH] feat(shared): Implement GitHub Spellcheck and grammar linting for Pull request. This pull request implements the GitHub Spellcheck feature to automatically check the spelling and grammar in commit messages for all Pull Requests (PRs). Changes Made: - Added GitHub Spellcheck and grammar linting integration to the repository - Configured the spellcheck tool to check commit messages in PRs - Configured the language tool for grammar linting. Fixes: #2327 Signed-off-by: sailajakommineni --- .github/.spellcheck.yaml | 24 ++++++++++ .github/.wordlist.txt | 43 ++++++++++++++++++ .github/workflows/spellcheck.yaml | 73 +++++++++++++++++++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 .github/.spellcheck.yaml create mode 100644 .github/.wordlist.txt create mode 100644 .github/workflows/spellcheck.yaml diff --git a/.github/.spellcheck.yaml b/.github/.spellcheck.yaml new file mode 100644 index 00000000000..a0fce1b88e2 --- /dev/null +++ b/.github/.spellcheck.yaml @@ -0,0 +1,24 @@ +--- +matrix: +- name: Markdown + expect_match: false + apsell: + mode: en + dictionary: + wordlists: + - .github/.wordlist.txt + output: wordlist.dic + encoding: utf-8 + pipeline: + - pyspelling.filters.markdown: + markdown_extensions: + - markdown.extensions.extra: + - pyspelling.filters.html: + comments: false + attributes: + - alt + ignores: + - ':matches(code, pre, .photoAuthor)' + - 'code' + - 'pre' + - 'blockquote' diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt new file mode 100644 index 00000000000..2c27005a337 --- /dev/null +++ b/.github/.wordlist.txt @@ -0,0 +1,43 @@ +Hyperledger +Corda +Ansible +DLT +DevOps +reStructuredText +Kubernetes +Github +TSC +mwagner +redhat +zyz +Alagbe +Cepeda +Deepak +Gómez +Jagpreet +Kumar +Picazo +Sarkar +Sasan +Suvajit +sownak +Opensource +Besu +ReadTheDocs +boolean +Codecov +tkuhrt +hamilton +jonathan +DCI +runtime +Tessera +IBFT +CII +rst +toctree +conf +py +md +pre +html diff --git a/.github/workflows/spellcheck.yaml b/.github/workflows/spellcheck.yaml new file mode 100644 index 00000000000..dc595921973 --- /dev/null +++ b/.github/workflows/spellcheck.yaml @@ -0,0 +1,73 @@ +--- +name: spell and grammer check +on: + push: + branches: + - "**" + pull_request_target: + branches: + - "**" + types: [opened, edited, updated] + +env: + SPELL_CHECK_DISABLED: false + GRAMMAR_CHECK_DISABLED: false + +jobs: + check-spelling-and-grammar: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + # Install the dependencies for grammer check and spell check. + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools + python -m pip install pyspelling + sudo apt-get install hunspell hunspell-en-us aspell aspell-en + pip install --user --upgrade language_tool_python + + - uses: actions/checkout@v2 + - name: Spellcheck + if: ${{ env.SPELL_CHECK_DISABLED == 'false' }} + uses: rojopolis/spellcheck-github-actions@0.34.0 + with: + config_path: .github/.spellcheck.yaml + source_files: "docs/README.md" # name of the file to check spell + task_name: Markdown + # To check the grammatical mistakes of the given files and folders. + - name: Run grammar check + if: ${{ env.GRAMMAR_CHECK_DISABLED == 'false' }} + run: | + cat <