Skip variable validation for dynamic environments (#178)

This commit is contained in:
Alex Howard
2025-12-06 17:38:01 -06:00
committed by GitHub
parent 4429c41275
commit 69b383af3d
2 changed files with 9 additions and 2 deletions
@@ -49,7 +49,7 @@ export async function getSecrets(
if (isString(x.value)) { if (isString(x.value)) {
environmentName = x.value.value; environmentName = x.value.value;
} else { } 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 // want to make sure we skip doing secret validation
secretsContext.complete = false; secretsContext.complete = false;
} }
@@ -26,6 +26,8 @@ export async function getVariables(
return secretsContext; return secretsContext;
} }
const variablesContext = defaultContext || new DescriptionDictionary();
let environmentName: string | undefined; let environmentName: string | undefined;
if (workflowContext?.job?.environment) { if (workflowContext?.job?.environment) {
if (isString(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.key) && x.key.value === "name") {
if (isString(x.value)) { if (isString(x.value)) {
environmentName = x.value.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; break;
} }
} }
} else {
// if the expression is something like environment: ${{ ... }} then we want to skip validation
variablesContext.complete = false;
} }
} }
const variablesContext = defaultContext || new DescriptionDictionary();
try { try {
const variables = await getRemoteVariables(octokit, cache, repo, environmentName); const variables = await getRemoteVariables(octokit, cache, repo, environmentName);