Search

Search IconIcon to open search

Automatic Grammar/Spellchecking on Markdown files (DevOps)

Last updatedUpdated: by Simon Späti · CreatedCreated: · 2 min read

Creating DevOps on Markdown, I thought could be a great idea for checking my blog/book, as it’s on GitHub already.

GitHub Actions: Resulting in artifacts with all spelling errors.

Spellcheck error result:

# GitHub Workflow of Actions

Example for GitHub Workflow:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: Spell Check Markdown Files

on:
  push:
    branches:
      - main

jobs:
  spellcheck:
    runs-on: ubuntu-latest

    steps:
    - name: Checkout Code
      uses: actions/checkout@v3

    - name: Set up Node.js
      uses: actions/setup-node@v3
      with:
        node-version: 'lts/*' #'16'  lts: action will always set up the latest LTS version available at runtime

    - name: Install Markdown Spellcheck
      run: |
        npm i markdown-spellcheck

    - name: Run Markdown Spellcheck
      run: |
        cd src
        find . -name "*.md" | xargs npx markdown-spellcheck -r -n -a --en-us | tee spellcheck-results.md

    - name: Upload spellcheck results as artifact
      uses: actions/upload-artifact@v3
      with:
        name: spellcheck-results
        path: src/spellcheck-results.md

    # - name: Commit and Push Spellcheck Results
    #   run: |
    #     git config --global user.name 'GitHub Actions'
    #     git config --global user.email 'actions@github.com'
    #     git add src/spellcheck-results.html
    #     git commit -m "Add spellcheck results"
    #     git push

# Other Actions


Origin: