b82ddcdb42
String replacement from `@github/actions-` to `@actions/`
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import {ValueProviderConfig} from "@actions/languageservice";
|
|
import {WorkflowContext} from "@actions/languageservice/context/workflow-context";
|
|
import {ValueProviderKind} from "@actions/languageservice/value-providers/config";
|
|
import {Octokit} from "@octokit/rest";
|
|
import {RepositoryContext} from "./initializationOptions";
|
|
import {TTLCache} from "./utils/cache";
|
|
import {getActionInputValues} from "./value-providers/action-inputs";
|
|
import {getEnvironments} from "./value-providers/job-environment";
|
|
import {getRunnerLabels} from "./value-providers/runs-on";
|
|
|
|
export function valueProviders(
|
|
client: Octokit | undefined,
|
|
repo: RepositoryContext | undefined,
|
|
cache: TTLCache
|
|
): ValueProviderConfig {
|
|
if (!repo || !client) {
|
|
return {};
|
|
}
|
|
|
|
return {
|
|
"job-environment": {
|
|
kind: ValueProviderKind.AllowedValues,
|
|
caseInsensitive: true,
|
|
get: () => getEnvironments(client, cache, repo.owner, repo.name)
|
|
},
|
|
"job-environment-name": {
|
|
kind: ValueProviderKind.AllowedValues,
|
|
caseInsensitive: true,
|
|
get: () => getEnvironments(client, cache, repo.owner, repo.name)
|
|
},
|
|
"runs-on": {
|
|
kind: ValueProviderKind.SuggestedValues,
|
|
get: () => getRunnerLabels(client, cache, repo.owner, repo.name)
|
|
},
|
|
"step-with": {
|
|
kind: ValueProviderKind.AllowedValues,
|
|
get: (context: WorkflowContext) => getActionInputValues(client, cache, context)
|
|
}
|
|
};
|
|
}
|