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

How to create a reusable check-spelling action complete with configuration files #41

Open
ricardo-dematos opened this issue Nov 30, 2022 · 4 comments

Comments

@ricardo-dematos
Copy link

ricardo-dematos commented Nov 30, 2022

I'm trying to create a wrapper to check-spelling/check-spelling , with the intention of simplifying the inputs and outputs, while also providing a set of words valid in the Valispace software context.

It resides in valispace/actions/check-spelling, along with the Configuration: Files.

The main workflow has :

- uses: valispace/actions/check-spelling@master
  with:
    event_aliases: '{ "schedule": "push" }'
    only_check_changed_files: '0'

The action is :

runs:
  using: composite
  steps:
    - id: spelling
      uses: check-spelling/check-spelling@v0.0.21
      with:
        event_aliases: '${{ inputs.event_aliases }}'
        only_check_changed_files: '${{ inputs.only_check_changed_files }}'
        post_comment: '0'
        config: '.'
        extra_dictionaries:
          cspell:en_GB/src/wordsEnGb.txt
          cspell:en_GB/src/additional_words.txt
          cspell:en_US/src/en_US.txt
          cspell:en_US/src/additional_words.txt
          cspell:en_US/src/contractions-and-possessives.txt
          cspell:en_US/src/hyphenated-words.txt
          cspell:pt_PT/Portuguese-European.txt
          cspell:software-terms/src/software-terms.txt
          cspell:software-terms/src/software-tools.txt
          cspell:software-terms/src/network-protocols.txt
          cspell:software-terms/src/network-os.txt
          cspell:cryptocurrencies/cryptocurrencies.txt
          cspell:public-licenses/src/generated/public-licenses.txt
          cspell:public-licenses/src/additional-licenses.txt
          cspell:lorem-ipsum/dictionary.txt
          cspell:mnemonics/src/mnemonics.txt
          cspell:companies/src/companies.txt
          cspell:aws/aws.txt
          cspell:docker/src/docker-words.txt
          cspell:bash/bash-words.txt
          cspell:fullstack/fullstack.txt
          cspell:django/django.txt
          cspell:django/requirements.txt
          cspell:node/additional_words.txt
          cspell:node/node.txt
          cspell:node/src/node-old.txt
          cspell:npm/npm.txt
          cspell:python/src/python/python.txt
          cspell:python/src/python/python-lib.txt
          cspell:python/src/common/extra.txt
          cspell:python/src/additional_words.txt
          cspell:typescript/typescript.txt
          cspell:html/html.txt
          cspell:html-symbol-entities/entities.txt
          cspell:css/css.txt
          cspell:fonts/fonts.txt
          cspell:filetypes/filetypes.txt

This configuration does not read the Configuration: Files!

I've tried in the valispace/actions/check-spelling action :

  • changing setting config to './check-spelling'
  • replacing setting config with just spell_check_this: 'valispace/actions/check-spelling@master'
  • create symbolic links from valispace/actions/check-spelling/.github/actions/spelling to valispace/actions/check-spelling for the Configuration: Files

None of this worked.

How can I make this work? 🧐


👉 In logs it seems that check-spelling/check-spelling is only capturing valispace/actions from setting spell_check_this: 'valispace/actions/check-spelling@master'.

@ricardo-dematos ricardo-dematos changed the title How to create a reusable check-spelling/check-spelling complete with configuration files How to create a reusable check-spelling action complete with configuration files Nov 30, 2022
@BenedekFarkas
Copy link

Hey @ricardo-dematos we've got both an action a workflow set up as a wrapper, please check out https://github.com/Lombiq/GitHub-Actions/blob/dev/Docs/Workflows.md#spelling-workflow!

@jsoref
Copy link
Member

jsoref commented Dec 22, 2022

I'd generally add debug: 1 and just read to see what it's doing.

Do you have an action run I could look through?

@ricardo-dematos
Copy link
Author

Hey @ricardo-dematos we've got both an action a workflow set up as a wrapper, please check out https://github.com/Lombiq/GitHub-Actions/blob/dev/Docs/Workflows.md#spelling-workflow!

@BenedekFarkas your workflow uses the check-spelling action from the same repo, right?

In my case I have a public repo with the check-spelling action and the idea is to use it from other organization repo's, thus sharing the dictionaries/configuration.

Cloning the check-spelling action across the organization repo's does work, like you have experienced, but it's a dumb solution, because I'm repeating the dictionaries/configurations in each organization repo.

@BenedekFarkas
Copy link

@ricardo-dematos yes, so our https://github.com/Lombiq/GitHub-Actions/blob/dev/.github/actions/spelling/action.yml action is a wrapper for https://github.com/check-spelling/check-spelling/blob/main/action.yml with some extras to increase reusability of our base configuration in other repositories of ours:

  • When the repository that we run the spell-checking on has its own configuration files, but not an advice.md, then we copy advice.md from https://github.com/Lombiq/GitHub-Actions that is a link to our own set of guidelines for maintaining the spell-checking configuration of a given repository.
  • Optionally merge/copy configuration files from https://github.com/Lombiq/GitHub-Actions to the repo under spell-checking, such as excludes.txt, line_forbidden.patterns and patterns.txt.
  • A few general-purpose dictionary files that you can optionally add to spell-checking.
  • The ability to extend/override the general-purpose configuration source prefixes and list of dictionary files that we defined in the wrapper action.

For example, our Open-Source Orchard Core Extensions repository runs spell-checking in its Build and Test workflow and even though it doesn't have its own patterns.txt file, it will "inherit" https://github.com/Lombiq/GitHub-Actions/blob/dev/.github/actions/spelling/patterns.txt.

Also, it has an excludes.txt file that will be extended with the entries from https://github.com/Lombiq/GitHub-Actions/blob/dev/.github/actions/spelling/excludes.txt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants