DEV Community

loading...
Cover image for Azure spell checker GitHub action

Azure spell checker GitHub action

Tony Diaz
🐊 Florida Gator alum. πŸ“š MBA. πŸ§‘πŸ»β€πŸ’»Engineer. πŸ‘πŸβ“‚οΈ IBMer
・2 min read

Spelling errors cause frustration for maintainers, it can delay a response or cause confusion in what is being discussed.

I'll admit, I'm not a great typist. I fat-finger keys and misspell words a lot. I try to be careful, write slowly, and proofread anything before sending a message. I also leverage tools that will flag spelling and grammar errors. When I write quickly it typically results in some misspellings.

Alt Text

My Workflow

The opensource community uses issues as a way of communicating problems feature requests questions, etc. Maintainers need to read each issue and all the comments. Spelling errors cause frustration for maintainers, it can delay a response or cause confusion in what is being discussed. To help a maintainer I have created a spell check using the Bing spell check API azure service.

Once a person leaves a comment on an issue an action will trigger to grab the text and spell-check it using the Azure API. If any corrections come back in the response the action will check how confident the suggestion is against what the configuration is set to. If the confidence is higher than the configured confidence, the action will update the word(s) automatically.

This can save a maintainer so much time that I wanted to submit it to this Hackathon.

Requirements

You will need to signup for Azure and create a Bing spell check service. This can all be done for free. Once created, you will get a Key and Endpoint that you can add to your Secrets in the repository.

Submission Category:

Maintainer Must-Haves

Yaml File

uses: tonydiaz/bing-spellcheck-github-action@main
with:
  spellchecker-key: ${{ secrets.SPELLCHECKER_KEY }}
  spellchecker-endpoint: ${{ secrets.SPELLCHECKER_ENDPOINT }}
  spellcheck-confidence: 0.90
  github-secret: ${{ secrets.GITHUB_TOKEN }}

Link to Code

Bing spell check github action

This action uses the Bing spell checker API to correct spelling errors in issue comments. You will need to register for an Microsoft Azure account to get the Bing spell check key and endpoint to use for this action.

Inputs

Required

SPELLCHECKER_KEY - The Bing spell check API key. Given when registering the service in Azure. SPELLCHECKER_ENDPOINT - The Bing spell check endpoint. Given when registering the service in Azure. GITHUB_TOKEN - Auto-created token from github for actions Provide a spell check confidence value. How confident should the suggested correction be to update the word? The default is 80%

Example usage

The key and endpoint should be be added as envrionment variables

uses: actions/bing-spellcheck-github-action@main
with:
  spellchecker-key: ${{ secrets.SPELLCHECKER_KEY }}
  spellchecker-endpoint: ${{ secrets.SPELLCHECKER_ENDPOINT }}
  spellcheck-confidence: 0.90
  github-secret: ${{ secrets.GITHUB_TOKEN }}

GitHub Action in action:

Alt Text

Additional Resources / Info

  • Dev username: tonydiaz

Discussion (2)

Collapse
ayabongaqwabi profile image
Ayabonga Qwabi

Can I test it on your repo?

Collapse
tonydiaz profile image
Tony Diaz Author • Edited

The repo in the post isn't set up for that action. I did create another one to test it out. It is currently active, but I suspect I may need to take it down since the API service charges after enough usage. The action I made only runs on issue comments not newly created issues. I mean to test issue creation also. github.com/tonydiaz/test-bing-spel...