DEV Community

Mike Rogers ✈️
Mike Rogers ✈️

Posted on • Updated on

Spell Check Commits & PRs

I hate having spelling mistakes in my code. I want to make sure the next person to sees my work has as few barriers to understanding it as possible. Plus as a bonus benefit, I like to discourage people from making weird abbreviations.

The GitHub Action I'm working on will expand on a GitHub Application I wrote, which can spell check commits when code is pushed to GitHub or a Pull Request is made.

My Workflow

I'm leveraging the Hunspell library via Ruby to check against language specific dictionaries along with a few custom dictionaries I'd previous built for my GitHub Application which does the same thing.

The aspects I'm mainly focusing on are:

  1. Making it work as a GitHub Action
  2. Use Docker, but make sure it's super fast
  3. Come up with a way people can contribute to the dictionaries easily
  4. I want to add a license aspect, so I can earn some cash from people using my GitHub Action while still staying Open Source.
# Add to: .github/workflows/spellcheck.yml
name: Typo CI

on:
  push:
    branches:
      - master
  pull_request:
jobs:
  spellcheck:
    name: Typo CI (GitHub Action)
    runs-on: ubuntu-latest
    timeout-minutes: 4
    if: "!contains(github.event.head_commit.message, '[ci skip]')"
    steps:
    - name: TypoCheck
      uses: typoci/spellcheck-action@master
      # with:
        # A license can be purchased via:
        # https://gumroad.com/l/MvvBE
        # typo_ci_license_key: ${{ secrets.TYPO_CI_LICENSE_KEY }}
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Enter fullscreen mode Exit fullscreen mode

Submission Category:

Maintainer Must-Haves

Link to Code

GitHub logo TypoCI / spellcheck-action

GitHub Action for checking code & Pull Requests for spelling mistakes

Typo CI Logo - It's a sword surrounded by brackets

Typo CI - Spellcheck Action

Checks for spelling mistakes within code via a GitHub Action

RSpec passing

👉 If you'd like to use this Action without having to add any files to your repository, consider the Typo CI GitHub App 👈

Installation

Copy add the following to .github/workflows/spellcheck.yml:

# Add to: .github/workflows/spellcheck.yml
name: Typo CI
on
  push:
    branches-ignore:
      - master
jobs:
  spellcheck:
    name: Typo CI (GitHub Action)
    runs-on: ubuntu-latest
    timeout-minutes: 4
    if: "!contains(github.event.head_commit.message, '[ci skip]')"
    steps:
    - name: TypoCheck
      uses: typoci/spellcheck-action@master
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Enter fullscreen mode Exit fullscreen mode

Configuration

You can tweak how Typo CI analyses your code by adding a .typo-ci.yml file to the root of your repository (You can also add it within your .github folder). Here is a sample file:

# This is a sample .typo-ci.yml file, it's used to configure how Typo
Enter fullscreen mode Exit fullscreen mode

Additional Resources / Info

My GitHub: https://github.com/MikeRogers0
The Original Marketplace App: https://github.com/marketplace/typo-ci

Top comments (3)

Collapse
 
delta456 profile image
Swastik Baranwal

Oh hey! I am from V Community and we are using this! Thanks for making this Actions

Collapse
 
mikerogers0 profile image
Mike Rogers ✈️

Thank you :D

Collapse
 
tracycss profile image
Jane Tracy 👩🏽‍💻

This is great. 🌟💯