Rename folders

This commit is contained in:
Christopher Schleiden
2023-02-22 15:52:40 -08:00
parent 16cc4d9bda
commit 2a3d63551f
469 changed files with 0 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
import {DescriptionDictionary} from "@github/actions-expressions";
import {ContextProviderConfig} from "@github/actions-languageservice";
import {WorkflowContext} from "@github/actions-languageservice/context/workflow-context";
import {Octokit} from "@octokit/rest";
import {getSecrets} from "./context-providers/secrets";
import {getStepsContext} from "./context-providers/steps";
import {getVariables} from "./context-providers/variables";
import {RepositoryContext} from "./initializationOptions";
import {TTLCache} from "./utils/cache";
export function contextProviders(
client: Octokit | undefined,
repo: RepositoryContext | undefined,
cache: TTLCache
): ContextProviderConfig {
if (!repo || !client) {
return {getContext: (_: string) => Promise.resolve(undefined)};
}
const getContext = async (
name: string,
defaultContext: DescriptionDictionary | undefined,
workflowContext: WorkflowContext
) => {
switch (name) {
case "secrets":
return await getSecrets(workflowContext, client, cache, repo, defaultContext);
case "vars":
return await getVariables(workflowContext, client, cache, repo, defaultContext);
case "steps":
return await getStepsContext(client, cache, defaultContext, workflowContext);
}
};
return {getContext};
}