handle the edge-cases
This commit is contained in:
@@ -45,40 +45,21 @@ export async function getSecrets(
|
|||||||
if (isString(workflowContext.job.environment)) {
|
if (isString(workflowContext.job.environment)) {
|
||||||
environmentName = workflowContext.job.environment.value;
|
environmentName = workflowContext.job.environment.value;
|
||||||
} else if (isMapping(workflowContext.job.environment)) {
|
} 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) {
|
for (const x of workflowContext.job.environment) {
|
||||||
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 {
|
} else {
|
||||||
isDynamicEnv = true;
|
secretsContext.complete = false;
|
||||||
}
|
}
|
||||||
break;
|
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);
|
const secrets = await getRemoteSecrets(octokit, cache, repo, environmentName);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user