spellcheck-github-actions icon indicating copy to clipboard operation
spellcheck-github-actions copied to clipboard

Git submodules as wordlist?

Open zfauser opened this issue 2 years ago • 2 comments

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.

zfauser avatar Oct 20 '22 19:10 zfauser

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

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

jonasbn avatar Oct 20 '22 20:10 jonasbn

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?

zfauser avatar Oct 20 '22 22:10 zfauser

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 avatar Jan 08 '23 12:01 jonasbn

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/[email protected]
      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 avatar Jan 22 '23 18:01 jonasbn

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

jonasbn avatar Jan 22 '23 19:01 jonasbn

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 avatar Jan 22 '23 20:01 jonasbn

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.

jonasbn avatar Jan 22 '23 20:01 jonasbn