rojopolis / spellcheck-github-actions

Spell check action
MIT License
138 stars 38 forks source link

Git submodules as wordlist? #128

Closed zfauser closed 1 year ago

zfauser commented 2 years ago

How would you use a git submodule as a wordlist, when I try to use it currently It always just returns that the wordlist could not be found.

jonasbn commented 2 years ago

hi @Zfauser do you have a public repository which demonstrating this?

My experience with submodules is limited and not full fond memories.

zfauser commented 2 years ago

Hey, unfortunately I do not and it's not possible for me to make one of the existing repos public, sorry. What we are essentially doing though is writing code documentation which involves many things that are not recognized in the dictionary (I.e. 'const') and instead of everyone individually discovering each of these I figured having one document we all collaborated on would make sense. Do you know if this would be possible or maybe just a different way of doing it?

jonasbn commented 1 year ago

Hi @Zfauser

I have been thinking about this problem and think I have foundation a solution. It does require some code changes. More information will follow...

jonasbn commented 1 year ago

Hi @Zfauser

Okay, here goes:

Using the config_path parameter for the GitHub action you can specify where you want your configuration to be placed.

name: Spellcheck Action
on: push
jobs:
  build:
    name: Spellcheck
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - uses: rojopolis/spellcheck-github-actions@0.29.0
      name: Spellcheck
      with:
        config_path: config/spellcheck.yml # put path to configuration file here

So you can place it in a directory, which you handle as a git submodule.

The above is the file controlling your workflow/action located in: .github/workflows/

REF: documentation

Inside the configuration of the, you can set the path of the custom dictionary / wordlist. This is the file pointed to in the above configuration.

matrix:
- name: Markdown
  aspell:
    lang: en
  dictionary:
    wordlists:
    - config/wordlist.txt
    encoding: utf-8
  pipeline:
  - pyspelling.filters.markdown:
  - pyspelling.filters.html:
      comments: false
      ignores:
      - code
      - pre
  sources:
  - '**/*.md'
  default_encoding: utf-8

REF: documentation

So you can place the wordlist in a directory, which you handle as a git submodule.

Please let me know if this is unclear or does not work. I do not work with git submodules, so I do not have a working example, all of the above is just deducted from the documentation and is untested in git submodule context.

I will make some updates to the documentation to emphasize the flexibility taken advantage of to meet your request.

jonasbn commented 1 year ago

I am might have run into an issue with the above approach, I will need to do some more testing...

jonasbn commented 1 year ago

Sorry about that, I am tired. I forgot to tell my local test to point to the moved configuration. I have a shell wrapper on the Docker image, which I call like so:

$ INPUT_CONFIG_PATH=".github/spellcheck.yml" spellchecker.sh

Forgot to set the environment variable, which is how the action configuration on GitHub communicates with the entry point in the Docker image.

jonasbn commented 1 year ago

Btw: you can see an example configuration here.

I believe you just have to isolate your configuration file(s) in a module you control as a git submodule and make the adjustments, then it should work.