-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Allow environment variable use in dictionary definitions #924
Comments
Thank you for the suggestion. I can see how using environment variables might be useful. I am assuming you are using a Things to note:
|
I took a quick look at your pull request. I see that the You can also use a 'use strict';
/** @type { import("@cspell/cspell-types").CSpellUserSettings } */
const cspell = {
description: 'Example config using environment variables.',
dictionaryDefinitions: [
{
name: 'repo-dict',
path: `${process.env['GITHUB_WORKSPACE']}/.github/etc/dictionary.txt`,
},
],
dictionaries: ['repo-dict'],
};
module.exports = cspell; |
Thank you, I will take a stab at moving to |
That worked wonderfully. Thank you! |
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. |
Is 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 theroot
user (/root
), but we need therunner
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.The text was updated successfully, but these errors were encountered: