Files
languageservices/actions-languageservice/src/value-providers/needs.ts
T
Laura Yu 330f62ebe7 Add needs value provider (#2)
* Add needs value provider
2022-11-23 10:54:15 -08:00

20 lines
501 B
TypeScript

import {Value} from "./config";
import {WorkflowTemplate} from "@github/actions-workflow-parser/model/workflow-template";
export function getJobNames(template: WorkflowTemplate | undefined): Value[] {
if (!template) {
return [];
}
const jobNames = new Set<string>();
const jobList = template.jobs;
for (const job of jobList) {
const name = job.id;
if (name && !jobNames.has(name)) {
jobNames.add(name);
}
}
return Array.from(jobNames).map(label => ({label}));
}