handle the edge-cases

This commit is contained in:
Felipe Suero
2023-05-02 11:22:00 -04:00
parent c4d478d459
commit 40c20d5504
@@ -45,40 +45,21 @@ export async function getSecrets(
if (isString(workflowContext.job.environment)) {
environmentName = workflowContext.job.environment.value;
} else if (isMapping(workflowContext.job.environment)) {
for (const x of workflowContext.job.environment) {
if (isString(x.key) && x.key.value === "name") {
if (isString(x.value)) {
environmentName = x.value.value;
}
break;
}
}
}
}
let isDynamicEnv = true;
if (workflowContext?.job?.environment) {
if (isMapping(workflowContext.job.environment)) {
for (const x of workflowContext.job.environment) {
if (isString(x.key) && x.key.value === "name") {
if (isString(x.value)) {
environmentName = x.value.value;
} else {
isDynamicEnv = true;
secretsContext.complete = false;
}
break;
}
}
} else {
secretsContext.complete = false;
}
}
console.log(`isDynamicEnv: ${isDynamicEnv}`)
console.log(`environmentName: ${environmentName}`)
// if (isDynamicEnv) {
secretsContext.complete = false;
return secretsContext;
// }
const secrets = await getRemoteSecrets(octokit, cache, repo, environmentName);