Skip to content

Commit

Permalink
Add check-spelling
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoref committed Dec 12, 2024
0 parents commit cff89d9
Showing 1 changed file with 239 additions and 0 deletions.
239 changes: 239 additions & 0 deletions .github/workflows/spelling.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
name: Check Spelling

# Comment management is handled through a secondary job, for details see:
# https://github.com/check-spelling/check-spelling/wiki/Feature%3A-Restricted-Permissions
#
# `jobs.comment-push` runs when a push is made to a repository and the `jobs.spelling` job needs to make a comment
# (in odd cases, it might actually run just to collapse a comment, but that's fairly rare)
# it needs `contents: write` in order to add a comment.
#
# `jobs.comment-pr` runs when a pull_request is made to a repository and the `jobs.spelling` job needs to make a comment
# or collapse a comment (in the case where it had previously made a comment and now no longer needs to show a comment)
# it needs `pull-requests: write` in order to manipulate those comments.

# Updating pull request branches is managed via comment handling.
# For details, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Update-expect-list
#
# These elements work together to make it happen:
#
# `on.issue_comment`
# This event listens to comments by users asking to update the metadata.
#
# `jobs.update`
# This job runs in response to an issue_comment and will push a new commit
# to update the spelling metadata.
#
# `with.experimental_apply_changes_via_bot`
# Tells the action to support and generate messages that enable it
# to make a commit to update the spelling metadata.
#
# `with.ssh_key`
# In order to trigger workflows when the commit is made, you can provide a
# secret (typically, a write-enabled github deploy key).
#
# For background, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Update-with-deploy-key

# SARIF reporting
#
# Access to SARIF reports is generally restricted (by GitHub) to members of the repository.
#
# Requires enabling `security-events: write`
# and configuring the action with `use_sarif: 1`
#
# For information on the feature, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-SARIF-output

# Minimal workflow structure:
#
# on:
# push:
# ...
# pull_request_target:
# ...
# jobs:
# # you only want the spelling job, all others should be omitted
# spelling:
# # remove `security-events: write` and `use_sarif: 1`
# # remove `experimental_apply_changes_via_bot: 1`
# ... otherwise adjust the `with:` as you wish

on:
push:
branches:
- "**"
tags-ignore:
- "**"
pull_request_target:
branches:
- "**"
types:
- "opened"
- "reopened"
- "synchronize"
issue_comment:
types:
- "created"

jobs:
spelling:
name: Check Spelling
permissions:
contents: read
pull-requests: read
actions: read
security-events: write
outputs:
followup: ${{ steps.spelling.outputs.followup }}
runs-on: ubuntu-latest
if: ${{ contains(github.event_name, 'pull_request') || github.event_name == 'push' }}
concurrency:
group: spelling-${{ github.event.pull_request.number || github.ref }}
# note: If you use only_check_changed_files, you do not want cancel-in-progress
cancel-in-progress: true
steps:
- name: check-spelling
id: spelling
uses: check-spelling/check-spelling@prerelease
with:
suppress_push_for_open_pull_request: ${{ github.actor != 'dependabot[bot]' && 1 }}
checkout: true
check_file_names: 1
spell_check_this: check-spelling/spell-check-this@prerelease
post_comment: 0
use_magic_file: 1
report-timing: 1
warnings: bad-regex,binary-file,deprecated-feature,ignored-expect-variant,large-file,limited-references,no-newline-at-eof,noisy-file,non-alpha-in-dictionary,token-is-substring,unexpected-line-ending,whitespace-in-dictionary,minified-file,unsupported-configuration,no-files-to-check,unclosed-block-ignore-begin,unclosed-block-ignore-end
experimental_apply_changes_via_bot: 1
use_sarif: ${{ (!github.event.pull_request || (github.event.pull_request.head.repo.full_name == github.repository)) && 1 }}
extra_dictionary_limit: 20
dictionary_source_prefixes: >
{
"cspell": "https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20230509/dictionaries/",
"cspell1": "https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20241114/dictionaries/"
}
check_extra_dictionaries: |
cspell1:ada/ada.txt
cspell1:aws/aws.txt
cspell1:clojure/clojure.txt
cspell1:companies/companies.txt
cspell1:cpp/compiler-clang-attributes.txt
cspell1:cpp/compiler-gcc.txt
cspell1:cpp/compiler-msvc.txt
cspell1:cpp/ecosystem.txt
cspell1:cpp/lang-jargon.txt
cspell1:cpp/lang-keywords.txt
cspell1:cpp/people.txt
cspell1:cpp/stdlib-c.txt
cspell1:cpp/stdlib-cerrno.txt
cspell1:cpp/stdlib-cmath.txt
cspell1:cpp/stdlib-cpp.txt
cspell1:cpp/template-strings.txt
cspell1:cryptocurrencies/cryptocurrencies.txt
cspell1:csharp/csharp.txt
cspell1:css/css.txt
cspell1:dart/dart.txt
cspell1:django/django.txt
cspell1:django/requirements.txt
cspell1:docker/docker-words.txt
cspell1:dotnet/dotnet.txt
cspell1:elixir/elixir.txt
cspell1:filetypes/filetypes.txt
cspell1:fonts/fonts.txt
cspell1:fullstack/fullstack.txt
cspell1:gaming-terms/gaming-terms.txt
cspell1:golang/go.txt
cspell1:haskell/haskell.txt
cspell1:html/html.txt
cspell1:java/java-terms.txt
cspell1:java/java.txt
cspell1:k8s/k8s.txt
cspell1:latex/latex.txt
cspell1:latex/samples/sample-words.txt
cspell1:lisp/lisp.txt
cspell1:lorem-ipsum/dictionary.txt
cspell1:lua/lua.txt
cspell1:mnemonics/mnemonics.txt
cspell1:monkeyc/monkeyc_keywords.txt
cspell1:node/node.txt
cspell1:npm/npm.txt
cspell1:php/php.txt
cspell1:powershell/powershell.txt
cspell1:public-licenses/generated/public-licenses.txt
cspell1:python/additional_words.txt
cspell1:python/common/extra.txt
cspell1:python/python/python-lib.txt
cspell1:python/python/python.txt
cspell1:r/r.txt
cspell1:redis/redis.txt
cspell1:ruby/ruby.txt
cspell1:rust/rust.txt
cspell1:scala/scala.txt
cspell1:shell/shell-all-words.txt
cspell1:software-terms/software-terms.txt
cspell1:software-terms/webServices.txt
cspell1:sql/sql.txt
cspell1:sql/tsql.txt
cspell1:svelte/svelte.txt
cspell1:swift/swift.txt
cspell1:typescript/typescript.txt
extra_dictionaries: |
cspell1:software-terms/softwareTerms.txt
comment-push:
name: Report (Push)
# If your workflow isn't running on push, you can remove this job
runs-on: ubuntu-latest
needs: spelling
permissions:
actions: read
contents: write
if: (success() || failure()) && needs.spelling.outputs.followup && github.event_name == 'push'
steps:
- name: comment
uses: check-spelling/check-spelling@prerelease
with:
checkout: true
spell_check_this: check-spelling/spell-check-this@prerelease
task: ${{ needs.spelling.outputs.followup }}

comment-pr:
name: Report (PR)
# If you workflow isn't running on pull_request*, you can remove this job
runs-on: ubuntu-latest
needs: spelling
permissions:
actions: read
contents: read
pull-requests: write
if: (success() || failure()) && needs.spelling.outputs.followup && contains(github.event_name, 'pull_request')
steps:
- name: comment
uses: check-spelling/check-spelling@prerelease
with:
checkout: true
spell_check_this: check-spelling/spell-check-this@prerelease
task: ${{ needs.spelling.outputs.followup }}
experimental_apply_changes_via_bot: 1

update:
name: Update PR
permissions:
contents: write
pull-requests: write
actions: read
runs-on: ubuntu-latest
if: ${{
github.event_name == 'issue_comment' &&
github.event.issue.pull_request &&
contains(github.event.comment.body, '@check-spelling-bot apply') &&
contains(github.event.comment.body, 'https://')
}}
concurrency:
group: spelling-update-${{ github.event.issue.number }}
cancel-in-progress: false
steps:
- name: apply spelling updates
uses: check-spelling/check-spelling@prerelease
with:
experimental_apply_changes_via_bot: 1
checkout: true
ssh_key: "${{ secrets.CHECK_SPELLING }}"

0 comments on commit cff89d9

Please sign in to comment.