Skip to content

Instantly share code, notes, and snippets.

@Akihide-Tsue
Last active March 8, 2024 06:45
Show Gist options
  • Save Akihide-Tsue/428c7e944091ddd34e0d5457de6e8557 to your computer and use it in GitHub Desktop.
Save Akihide-Tsue/428c7e944091ddd34e0d5457de6e8557 to your computer and use it in GitHub Desktop.
Github Actionsでのtypo防止
// .cspell/cspell.cjs
/** @type { import("@cspell/cspell-types").CSpellUserSettings } */
module.exports = {
$schema:
"https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json",
version: "0.2",
// dictionaryDefinitions[number].name と同じ名前を指定する
dictionaries: ["words"],
// カスタム辞書ファイル配列、複数指定可能
dictionaryDefinitions: [
// 辞書ファイル
{
name: "words",
path: "./words.txt",
addWords: true,
},
],
// cSpell 除外設定
ignorePaths: [
"./yarn.lock",
"**/*.json",
"**/*.svg",
"**/*.md",
"**/*.mjs",
"**/*.sh",
"**/*.yml",
"**/*.yaml",
"**/*.config.js",
"**/*.config.ts",
"**/api.ts",
"**/.cspell/**/*",
],
}
// .vscode/settings.json
{
"cSpell.customDictionaries": {
"words": {
"name": "words",
"path": "${workspaceRoot}/.cspell/words.txt",
"description": "Words used in this project",
"addWords": true
},
"custom": true,
"internal-terms": false
}
}
name: spell-check
on:
pull_request:
types: [opened, synchronize, edited]
jobs:
spell-check:
runs-on: ubuntu-latest
# [bot]を含む場合は除外
if: ${{ !contains(github.actor, '[bot]') }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
- uses: actions/setup-node@v2
with:
node-version: "18.x"
- name: Install dependencies
run: yarn --frozen-lockfile
shell: bash
- uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest
- name: execute spell-check
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git diff remotes/origin/$GITHUB_BASE_REF --name-only \
| yarn spell-check \
| reviewdog -efm="%f:%l:%c - %m" -reporter=github-pr-review
// .cspell/words.txt
reviewdog
YYYYMMDDEEE
hhmm
gtag
nextjs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment