diff --git a/languageserver/src/context-providers/secrets.ts b/languageserver/src/context-providers/secrets.ts index 40b34f0f..75078355 100644 --- a/languageserver/src/context-providers/secrets.ts +++ b/languageserver/src/context-providers/secrets.ts @@ -49,7 +49,7 @@ export async function getSecrets( if (isString(x.value)) { environmentName = x.value.value; } else { - // this means we have a dynamic enviornment, in those situations we + // this means we have a dynamic environment, in those situations we // want to make sure we skip doing secret validation secretsContext.complete = false; } diff --git a/languageserver/src/context-providers/variables.ts b/languageserver/src/context-providers/variables.ts index 7926ab6c..e26fc81d 100644 --- a/languageserver/src/context-providers/variables.ts +++ b/languageserver/src/context-providers/variables.ts @@ -26,6 +26,8 @@ export async function getVariables( return secretsContext; } + const variablesContext = defaultContext || new DescriptionDictionary(); + let environmentName: string | undefined; if (workflowContext?.job?.environment) { if (isString(workflowContext.job.environment)) { @@ -35,14 +37,19 @@ export async function getVariables( if (isString(x.key) && x.key.value === "name") { if (isString(x.value)) { environmentName = x.value.value; + } else { + // this means we have a dynamic environment, in those situations we want to skip validation + variablesContext.complete = false; } break; } } + } else { + // if the expression is something like environment: ${{ ... }} then we want to skip validation + variablesContext.complete = false; } } - const variablesContext = defaultContext || new DescriptionDictionary(); try { const variables = await getRemoteVariables(octokit, cache, repo, environmentName);