Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(spell-check): support local dictionary #176

Merged
merged 2 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions spell-check/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ jobs:
uses: autowarefoundation/autoware-github-actions/spell-check@v1
with:
cspell-json-url: https://raw.githubusercontent.com/tier4/autoware-spell-check-dict/main/.cspell.json
local-cspell-json: .cspell.json
```

## Inputs

| Name | Required | Description |
| --------------- | -------- | ----------------------------- |
| cspell-json-url | true | The URL to `.cspell.json`. |
| token | false | The token for `.cspell.json`. |
| Name | Required | Description |
| ----------------- | -------- | ---------------------------------------- |
| cspell-json-url | true | The URL to the remote `.cspell.json`. |
| local-cspell-json | false | The path to the local `.cspell.json`. |
| token | false | The token for the remote `.cspell.json`. |

## Outputs

Expand Down
23 changes: 21 additions & 2 deletions spell-check/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ inputs:
cspell-json-url:
description: ""
required: true
local-cspell-json:
description: ""
required: false
default: .cspell.json
token:
description: ""
required: false
Expand All @@ -13,12 +17,27 @@ inputs:
runs:
using: composite
steps:
- name: Retrieve spell check dictionary
- name: Retrieve remote dictionary
run: |
curl -fsSL -o .cspell.json ${{ inputs.cspell-json-url }} \
curl -fsSL -o remote.cspell.json ${{ inputs.cspell-json-url }} \
-H "Authorization: token ${{ inputs.token }}"
shell: bash

- name: Prepare local dictionary
run: |
if [ -f "${{ inputs.local-cspell-json }}" ]; then
cp ${{ inputs.local-cspell-json }} local.cspell.json || true
else
echo "No local dictionary found."
echo "{}" > local.cspell.json
fi
shell: bash

- name: Create combined dictionary
run: |
echo '{ "import": ["./remote.cspell.json", "./local.cspell.json"] }' > .cspell.json
shell: bash

- name: Run spell check
uses: streetsidesoftware/cspell-action@v2
with:
Expand Down