MCPcopy
hub / github.com/firecow/gitlab-ci-local / expandInclude

Method expandInclude

src/parser-includes.ts:212–243  ·  view source on GitHub ↗
(i: any, variables: {[key: string]: string})

Source from the content-addressed store, hash-verified

210 }
211
212 static expandInclude (i: any, variables: {[key: string]: string}): any[] {
213 let include = i || [];
214 if (include && include.length == null) {
215 include = [ i ];
216 }
217 if (typeof include === "string") {
218 include = [include];
219 }
220
221 for (const [index, entry] of Object.entries(include)) {
222 if (typeof entry === "string" && (entry.startsWith("https:") || entry.startsWith("http:"))) {
223 include[index] = {"remote": entry};
224 } else if (typeof entry === "string") {
225 include[index] = {"local": entry};
226 } else {
227 include[index] = entry;
228 }
229
230 }
231
232 for (const entry of include) {
233 for (const [key, value] of Object.entries(entry)) {
234 if (Array.isArray(value)) {
235 entry[key] = value.map((v) => Utils.expandText(v, variables));
236 } else {
237 entry[key] = Utils.expandText(value, variables);
238 }
239 }
240 }
241
242 return include;
243 }
244
245 static covertTemplateToProjectFile (template: string): {project: string; ref: string; file: string; domain: string} {
246 return {

Callers 2

initMethod · 0.95

Calls 1

expandTextMethod · 0.80

Tested by

no test coverage detected