From 69b383af3d3c80ad91f89629a4d6f2b26c6c9a34 Mon Sep 17 00:00:00 2001 From: Alex Howard Date: Sat, 6 Dec 2025 18:38:01 -0500 Subject: [PATCH] Skip variable validation for dynamic environments (#178) --- languageserver/src/context-providers/secrets.ts | 2 +- languageserver/src/context-providers/variables.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/languageserver/src/context-providers/secrets.ts b/languageserver/src/context-providers/secrets.ts index 40b34f0..7507835 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 7926ab6..e26fc81 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);