Remove unnecessary async functions
This commit is contained in:
@@ -19,23 +19,21 @@ export const DEFAULT_RUNNER_LABELS = [
|
||||
"self-hosted"
|
||||
];
|
||||
|
||||
/* eslint-disable @typescript-eslint/require-await */
|
||||
export const defaultValueProviders: ValueProviderConfig = {
|
||||
needs: {
|
||||
kind: ValueProviderKind.AllowedValues,
|
||||
get: needs
|
||||
get: context => Promise.resolve(needs(context))
|
||||
},
|
||||
"workflow-job-with": {
|
||||
kind: ValueProviderKind.AllowedValues,
|
||||
get: async context => reusableJobInputs(context)
|
||||
get: context => Promise.resolve(reusableJobInputs(context))
|
||||
},
|
||||
"workflow-job-secrets": {
|
||||
kind: ValueProviderKind.SuggestedValues,
|
||||
get: async (context, existingValues) => reusableJobSecrets(context, existingValues)
|
||||
get: (context, existingValues) => Promise.resolve(reusableJobSecrets(context, existingValues))
|
||||
},
|
||||
"runs-on": {
|
||||
kind: ValueProviderKind.SuggestedValues,
|
||||
get: async () => stringsToValues(DEFAULT_RUNNER_LABELS)
|
||||
get: () => Promise.resolve(stringsToValues(DEFAULT_RUNNER_LABELS))
|
||||
}
|
||||
};
|
||||
/* eslint-enable @typescript-eslint/require-await */
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
import {WorkflowContext} from "../context/workflow-context";
|
||||
import {Value} from "./config";
|
||||
|
||||
export function needs(context: WorkflowContext): Promise<Value[]> {
|
||||
export function needs(context: WorkflowContext): Value[] {
|
||||
if (!context.template) {
|
||||
return Promise.resolve([]);
|
||||
return [];
|
||||
}
|
||||
|
||||
const uniquejobIDs = new Set(context.template.jobs.map(j => j.id)).values();
|
||||
return Promise.resolve(
|
||||
Array.from(uniquejobIDs)
|
||||
.filter(x => x.value !== context.job?.id.value)
|
||||
.map(x => ({label: x.value}))
|
||||
);
|
||||
return Array.from(uniquejobIDs)
|
||||
.filter(x => x.value !== context.job?.id.value)
|
||||
.map(x => ({label: x.value}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user