Allow environment variable use in dictionary definitions
See original GitHub issueIs your feature request related to a problem? Please describe.
I am using cspell
in a github action, and I would like to allow repositories that use the action to provide a custom dictionary in addition to the dictionaries that the action provides.
Describe the solution you’d like I would like the ability to use environment variables in a dictionary definition path.
Describe alternatives you’ve considered
Attempted a partial workaround using ~
, but that expands to the $HOME
for the root
user (/root
), but we need the runner
home dir. Using ~runner
resulted in /rootrunner
.
I also attempted to glob the directories that change per-github action user in the dictionary definition (with a hard coded home directory due to the above issue) via /home/runner/work/*/*/.github/etc/dictionary.txt
and received the following:
Dictionary Error with (per-repository dictionary) Error: ENOENT: no such file or directory, open '/home/runner/work/*/*/.github/etc/dictionary.txt'
Note that dictionary.txt
is anticipated to be in ${GITHUB_WORKSPACE}/.github/etc/dictionary.txt
during the GitHub actions run. I was able to confirm that this file did exist there as expected during my testing; I have avoided any workarounds using symlinks so far.
Additional context
packages/cspell-lib/src/util/resolveFile.ts
appears to have very specific support for ^~
only, which uses $HOME
and is the closest support to this request that I could find.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
I took a quick look at your pull request.
I see that the
cspell
config file is part of the action and not part of the repository. In that case relative path won’t exactly work.You can also use a
cspell.config.js
file instead of a.json
file.This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.