-
Notifications
You must be signed in to change notification settings - Fork 723
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(shared): Implement GitHub Spellcheck and grammar linting for Pul…
…l 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 <[email protected]>
- Loading branch information
1 parent
eab1d4d
commit ce6030e
Showing
3 changed files
with
122 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,25 @@ | ||
--- | ||
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' | ||
|
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,36 @@ | ||
Hyperledger | ||
Corda | ||
Ansible | ||
DLT | ||
DevOps | ||
Hyperledger | ||
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 |
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,61 @@ | ||
--- | ||
name: spell and grammer check | ||
on: | ||
push: | ||
branches: | ||
- "**" | ||
pull_request: | ||
paths: | ||
- "**" #(provide name of the file or folder) | ||
jobs: | ||
check-spelling: | ||
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 pylanguagetool | ||
- uses: actions/checkout@master | ||
- name: Spellcheck | ||
uses: rojopolis/[email protected] | ||
with: | ||
config_path: .github/.spellcheck.yaml | ||
source_files: "filename" # name of the file to check spell and grammer) | ||
task_name: Markdown | ||
# To check the grammatical mistakes of the given files and folders. | ||
- name: Run grammar check | ||
run: | | ||
# Read the text from all files in the directory and its subdirectories | ||
files_to_check=$(find folder/filename -type f) #(folder/filename=which folder need to check the grammer) | ||
# Define the LanguageTool API URL and language (e.g., en-US for English) | ||
api_url="https://languagetool.org/api/v2/check" | ||
language="en-US" | ||
for file in $files_to_check; do | ||
# Read the content of each file | ||
text_to_check=$(cat "$file") | ||
# Send a POST request to the LanguageTool API and store the response in a variable | ||
response=$(curl -s -d "text=$text_to_check" -d "language=$language" "$api_url") | ||
# Check if the response file exists | ||
if [[ $response == *"matches"* ]]; then | ||
matches=$(echo "$response" | jq -r '.matches[] | "Grammar error at line \(.offset + 1) - \(.message)"') | ||
if [[ -n $matches ]]; then | ||
echo "Grammar errors found in file: $file" | ||
echo "$matches" | ||
exit 1 | ||
fi | ||
fi | ||
echo "No grammar errors found in file: $file" | ||
done |