@sverka/compiler 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +29 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +86 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -186,6 +186,18 @@ export declare function pinActionRef(ref: string, registry: PinRegistry): string
|
|
|
186
186
|
export declare function loadBundledRegistry(): PinRegistry;
|
|
187
187
|
//#endregion
|
|
188
188
|
//#region src/github/types.d.ts
|
|
189
|
+
interface GithubStep {
|
|
190
|
+
readonly id?: string;
|
|
191
|
+
readonly name?: string;
|
|
192
|
+
readonly run?: string;
|
|
193
|
+
readonly uses?: string;
|
|
194
|
+
readonly with?: Record<string, unknown>;
|
|
195
|
+
readonly env?: Record<string, string>;
|
|
196
|
+
readonly if?: string;
|
|
197
|
+
readonly continueOnError?: boolean;
|
|
198
|
+
readonly workingDirectory?: string;
|
|
199
|
+
readonly shell?: string;
|
|
200
|
+
}
|
|
189
201
|
interface GeneratedArtifact {
|
|
190
202
|
readonly path: string;
|
|
191
203
|
readonly content: string;
|
|
@@ -201,12 +213,27 @@ interface CompilationResult {
|
|
|
201
213
|
readonly artifacts: readonly GeneratedArtifact[];
|
|
202
214
|
readonly diagnostics: readonly TargetDiagnostic[];
|
|
203
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* Optional {@link GithubTarget} constructor config. Spec 22.
|
|
218
|
+
*/
|
|
219
|
+
interface GithubTargetConfig {
|
|
220
|
+
/** Action SHA pinning policy; defaults to `{ mode: "off" }` with the bundled registry. */
|
|
221
|
+
readonly pinning?: PinningConfig;
|
|
222
|
+
/**
|
|
223
|
+
* Steps injected into every job after Checkout and before the step's own
|
|
224
|
+
* operations — toolchain setup (`uses:` actions) and dependency installs
|
|
225
|
+
* (`run:` commands) the target runner does not provide.
|
|
226
|
+
*/
|
|
227
|
+
readonly setup?: readonly GithubStep[];
|
|
228
|
+
/** Extra `with:` inputs merged into the Checkout step of every job. */
|
|
229
|
+
readonly checkoutWith?: Record<string, unknown>;
|
|
230
|
+
}
|
|
204
231
|
//#endregion
|
|
205
232
|
//#region src/github/target.d.ts
|
|
206
233
|
/**
|
|
207
234
|
* Convenience function: analyze → lower → emit in one call.
|
|
208
235
|
*/
|
|
209
|
-
export declare function compileGithub(graph: DefinitionGraph): CompilationResult;
|
|
236
|
+
export declare function compileGithub(graph: DefinitionGraph, config?: GithubTargetConfig): CompilationResult;
|
|
210
237
|
//#endregion
|
|
211
238
|
//#region src/gitlab/types.d.ts
|
|
212
239
|
interface GeneratedArtifact$1 {
|
|
@@ -231,5 +258,5 @@ interface CompilationResult$1 {
|
|
|
231
258
|
*/
|
|
232
259
|
export declare function compileGitlab(graph: DefinitionGraph): CompilationResult$1;
|
|
233
260
|
//#endregion
|
|
234
|
-
export type { CapabilityDetail, CapabilityDiagnostic, CapabilityManifest, CapabilitySupport, CompilationResult, ConnectorFactory, Engine, GeneratedArtifact, GraphTransform, GraphValidator, Importer, ModelContribution, NativeExtension, PinRegistry, PinningConfig, PluginErrorCode, PluginMeta, PluginOptions, PluginRegistry, SverkaPlugin, Target, TargetDiagnostic, ToolDefinition, ToolProvider, ToolResult, ToolResultContent };
|
|
261
|
+
export type { CapabilityDetail, CapabilityDiagnostic, CapabilityManifest, CapabilitySupport, CompilationResult, ConnectorFactory, Engine, GeneratedArtifact, GithubStep, GithubTargetConfig, GraphTransform, GraphValidator, Importer, ModelContribution, NativeExtension, PinRegistry, PinningConfig, PluginErrorCode, PluginMeta, PluginOptions, PluginRegistry, SverkaPlugin, Target, TargetDiagnostic, ToolDefinition, ToolProvider, ToolResult, ToolResultContent };
|
|
235
262
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/plugin/types.ts","../src/plugin/factory.ts","../src/plugin/capabilities.ts","../src/plugin/errors.ts","../src/github/pinning.ts","../src/github/types.ts","../src/github/target.ts","../src/gitlab/types.ts","../src/gitlab/target.ts"],"mappings":";;KAQY;UAQK;WACN,SAAS;WACT;WACA;;KAGC,qBAAqB,eAAe,oBAAoB;UAEnD;WACN;WACA,SAAS;WACT;WACA;WACA;;UAOM;WACN;WACA;;UAGM;WACN;EACT,UAAU,OAAO,kBAAkB;;UAGpB;WACN;EACT,SAAS,OAAO,2BAA2B;;UAG5B;WACN;EACT,QAAQ,OAAO,kBAAkB;;UAGlB;WACN;aAA+B;aAAuB;;WACtD,sBAAsB;;UAGhB;WACN;EACT,MAAM,gBAAgB;;UAGP;WACN;EACT,QAAQ;;UAGO;WACN;EACT,OAAO;;UAGQ;WACN;WACA;WACA;WACA;;UAOM;;WAEN;WACA;;WAEA,cAAc,SAAS;;KAGtB;WACG;WAAuB;;WACvB;WAAwB;WAAuB;;WAE/C;WACA;aAAqB;aAAsB;;;UAGzC;WACN,kBAAkB;WAClB;;;;;;;UAQM;EACf,aAAa,iBAAiB;EAC9B,SACE,cACA,OAAO,SAAS,2BACf,QAAQ;EACX,YAAY;;UAOG;WACN;WACA;WACA,eAAe;WACf,iBAAiB;WACjB,sBAAsB;WACtB,sBAAsB;WACtB,mBAAmB;WACnB,qBAAqB;WACrB,mBAAmB;WACnB,sBAAsB;WACtB,sBAAsB;;WAEtB,QAAQ;;UAGF;YACL;;UAGK;WACN;;UAOM;EACf,SAAS,QAAQ;WACR,kBAAkB;EAC3B,mBAAmB;;;;;;;;;;;;;;;wBC5IL,mBACd,UAAU,UAAU,eAAe,OAAO,eAAe,cACzD,UAAU,gBACT;;;;wBA+Da,wBAAwB;;;;;;;wBCqUxB,mBAAmB,OAAO,kBAAkB;;;;;;wBA6D5C,oBACd,OAAO,iBACP,oBAAoB,gCACV;;;KCtdA;qBAKC,oBAAoB;WACtB,MAAM;WACG;EAEN,YAAA,iBAAiB,MAAM,iBAAiB;;;;;UCDrC;YACL;;;UAIK;;WAEN;;WAEA,WAAW;;;;;;;;;;;;;wBAgBN,aAAa,aAAa,UAAU;;;;wBAwBpC,uBAAuB;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/plugin/types.ts","../src/plugin/factory.ts","../src/plugin/capabilities.ts","../src/plugin/errors.ts","../src/github/pinning.ts","../src/github/types.ts","../src/github/target.ts","../src/gitlab/types.ts","../src/gitlab/target.ts"],"mappings":";;KAQY;UAQK;WACN,SAAS;WACT;WACA;;KAGC,qBAAqB,eAAe,oBAAoB;UAEnD;WACN;WACA,SAAS;WACT;WACA;WACA;;UAOM;WACN;WACA;;UAGM;WACN;EACT,UAAU,OAAO,kBAAkB;;UAGpB;WACN;EACT,SAAS,OAAO,2BAA2B;;UAG5B;WACN;EACT,QAAQ,OAAO,kBAAkB;;UAGlB;WACN;aAA+B;aAAuB;;WACtD,sBAAsB;;UAGhB;WACN;EACT,MAAM,gBAAgB;;UAGP;WACN;EACT,QAAQ;;UAGO;WACN;EACT,OAAO;;UAGQ;WACN;WACA;WACA;WACA;;UAOM;;WAEN;WACA;;WAEA,cAAc,SAAS;;KAGtB;WACG;WAAuB;;WACvB;WAAwB;WAAuB;;WAE/C;WACA;aAAqB;aAAsB;;;UAGzC;WACN,kBAAkB;WAClB;;;;;;;UAQM;EACf,aAAa,iBAAiB;EAC9B,SACE,cACA,OAAO,SAAS,2BACf,QAAQ;EACX,YAAY;;UAOG;WACN;WACA;WACA,eAAe;WACf,iBAAiB;WACjB,sBAAsB;WACtB,sBAAsB;WACtB,mBAAmB;WACnB,qBAAqB;WACrB,mBAAmB;WACnB,sBAAsB;WACtB,sBAAsB;;WAEtB,QAAQ;;UAGF;YACL;;UAGK;WACN;;UAOM;EACf,SAAS,QAAQ;WACR,kBAAkB;EAC3B,mBAAmB;;;;;;;;;;;;;;;wBC5IL,mBACd,UAAU,UAAU,eAAe,OAAO,eAAe,cACzD,UAAU,gBACT;;;;wBA+Da,wBAAwB;;;;;;;wBCqUxB,mBAAmB,OAAO,kBAAkB;;;;;;wBA6D5C,oBACd,OAAO,iBACP,oBAAoB,gCACV;;;KCtdA;qBAKC,oBAAoB;WACtB,MAAM;WACG;EAEN,YAAA,iBAAiB,MAAM,iBAAiB;;;;;UCDrC;YACL;;;UAIK;;WAEN;;WAEA,WAAW;;;;;;;;;;;;;wBAgBN,aAAa,aAAa,UAAU;;;;wBAwBpC,uBAAuB;;;UC1BtB;WACN;WACA;WACA;WACA;WACA,OAAO;WACP,MAAM;WACN;WACA;WACA;WACA;;UAoEM;WACN;WACA;;UAGM;WACN;WACA,SAAS;WACT;WACA;WACA;;UAGM;WACN,oBAAoB;WACpB,sBAAsB;;;;;UAMhB;;WAEN,UAAU;;;;;;WAMV,iBAAiB;;WAEjB,eAAe;;;;;;;wBCgBV,cACd,OAAO,iBACP,SAAS,qBACR;;;UCVc;WACN;WACA;;UAGM;WACN;WACA,SAAS;WACT;WACA;WACA;;UAGM;WACN,oBAAoB;WACpB,sBAAsB;;;;;;;wBCvGjB,cAAc,OAAO,kBAAkB"}
|
package/dist/index.mjs
CHANGED
|
@@ -522,33 +522,63 @@ function wrapStdoutCaptureLine(command, names) {
|
|
|
522
522
|
* - Call steps become `uses:` jobs.
|
|
523
523
|
* Single-pipeline graphs (no calls) are unchanged (backward compat).
|
|
524
524
|
*/
|
|
525
|
-
function lowerGithub(graph) {
|
|
525
|
+
function lowerGithub(graph, config) {
|
|
526
526
|
if (graph.project.pipelines.length === 0) throw new GithubTargetError("graph has no pipelines", "INVALID_GRAPH");
|
|
527
527
|
if (graph.project.pipelines.length === 1) {
|
|
528
528
|
const pipeline = graph.project.pipelines[0];
|
|
529
|
-
if (!pipeline.steps.some((s) => s.call || s.component || s.childPipeline || s.downstream)) return lowerSinglePipeline(pipeline);
|
|
529
|
+
if (!pipeline.steps.some((s) => s.call || s.component || s.childPipeline || s.downstream)) return lowerSinglePipeline(pipeline, config);
|
|
530
530
|
}
|
|
531
|
-
return lowerMultiPipeline(graph);
|
|
531
|
+
return lowerMultiPipeline(graph, config);
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* The Checkout step shared by every job, with optional `with:` inputs
|
|
535
|
+
* (e.g. `submodules: recursive`) from {@link GithubTargetConfig.checkoutWith}.
|
|
536
|
+
*/
|
|
537
|
+
function checkoutStep(config) {
|
|
538
|
+
return {
|
|
539
|
+
name: "Checkout",
|
|
540
|
+
uses: "actions/checkout@v4",
|
|
541
|
+
...config?.checkoutWith ? { with: config.checkoutWith } : {}
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Toolchain/dependency setup steps injected after Checkout in every job
|
|
546
|
+
* that executes user commands (shell and component steps).
|
|
547
|
+
*/
|
|
548
|
+
function setupSteps(config) {
|
|
549
|
+
return config?.setup ?? [];
|
|
532
550
|
}
|
|
533
551
|
/**
|
|
534
552
|
* Lower a single pipeline (no calls) — original v0 behavior.
|
|
535
553
|
*/
|
|
536
|
-
function lowerSinglePipeline(pipeline) {
|
|
554
|
+
function lowerSinglePipeline(pipeline, config) {
|
|
537
555
|
const reachableSteps = filterReachableSteps$1(pipeline);
|
|
538
556
|
const jobIdMap = buildJobIdMap$1(reachableSteps);
|
|
539
|
-
return assemblePipelineTarget(pipeline, lowerTriggers$1(pipeline.entries, pipeline.inputs), lowerStepsWithCalls(reachableSteps, jobIdMap, pipeline.id));
|
|
557
|
+
return assemblePipelineTarget(pipeline, lowerTriggers$1(pipeline.entries, pipeline.inputs), lowerStepsWithCalls(reachableSteps, jobIdMap, pipeline.id, config));
|
|
540
558
|
}
|
|
541
559
|
/**
|
|
542
560
|
* Assemble a GithubTargetGraph from a pipeline, its triggers, and jobs.
|
|
543
561
|
* Shared by lowerSinglePipeline and lowerMultiPipeline.
|
|
544
562
|
*/
|
|
545
563
|
function assemblePipelineTarget(pipeline, triggers, jobs) {
|
|
564
|
+
const grants = pipeline.permissions;
|
|
565
|
+
const jobsWithPermissions = grants === void 0 ? jobs : jobs.map((job) => {
|
|
566
|
+
if (job.permissions !== void 0) return job;
|
|
567
|
+
const permissions = job.steps.some((s) => s.uses?.startsWith("github/codeql-action/upload-sarif@")) ? {
|
|
568
|
+
...grants,
|
|
569
|
+
"security-events": "write"
|
|
570
|
+
} : grants;
|
|
571
|
+
return {
|
|
572
|
+
...job,
|
|
573
|
+
permissions
|
|
574
|
+
};
|
|
575
|
+
});
|
|
546
576
|
return {
|
|
547
577
|
name: pipeline.id,
|
|
548
578
|
on: triggers,
|
|
549
|
-
jobs,
|
|
579
|
+
jobs: jobsWithPermissions,
|
|
550
580
|
env: collectEnv(pipeline),
|
|
551
|
-
...pipeline.permissions !== void 0 ? { permissions:
|
|
581
|
+
...pipeline.permissions !== void 0 ? { permissions: {} } : {},
|
|
552
582
|
...pipeline.defaults !== void 0 ? { defaults: lowerDefaults(pipeline.defaults) } : {},
|
|
553
583
|
...pipeline.concurrency !== void 0 ? { concurrency: pipeline.concurrency } : {}
|
|
554
584
|
};
|
|
@@ -566,12 +596,12 @@ function lowerDefaults(defaults) {
|
|
|
566
596
|
* Lower a multi-pipeline graph. Each pipeline that has entries OR is referenced
|
|
567
597
|
* by a call step gets its own workflow file.
|
|
568
598
|
*/
|
|
569
|
-
function lowerMultiPipeline(graph) {
|
|
599
|
+
function lowerMultiPipeline(graph, config) {
|
|
570
600
|
const pipelines = graph.project.pipelines;
|
|
571
601
|
const calledPipelineIds = collectCalledPipelineIds(pipelines);
|
|
572
602
|
const result = [];
|
|
573
603
|
for (const pipeline of pipelines) {
|
|
574
|
-
const target = lowerPipelineInGraph(pipeline, calledPipelineIds.has(pipeline.id));
|
|
604
|
+
const target = lowerPipelineInGraph(pipeline, calledPipelineIds.has(pipeline.id), config);
|
|
575
605
|
if (target !== void 0) result.push(target);
|
|
576
606
|
}
|
|
577
607
|
return result;
|
|
@@ -588,14 +618,14 @@ function collectCalledPipelineIds(pipelines) {
|
|
|
588
618
|
* Lower a single pipeline within a multi-pipeline graph.
|
|
589
619
|
* Returns undefined if the pipeline is neither a root nor a callee.
|
|
590
620
|
*/
|
|
591
|
-
function lowerPipelineInGraph(pipeline, isCalled) {
|
|
621
|
+
function lowerPipelineInGraph(pipeline, isCalled, config) {
|
|
592
622
|
const hasEntries = pipeline.entries.length > 0;
|
|
593
623
|
if (!hasEntries && !isCalled) return void 0;
|
|
594
624
|
const reachableSteps = hasEntries ? filterReachableSteps$1(pipeline) : pipeline.steps;
|
|
595
625
|
const jobIdMap = buildJobIdMap$1(reachableSteps);
|
|
596
626
|
let triggers = lowerTriggers$1(pipeline.entries, pipeline.inputs);
|
|
597
627
|
if (isCalled) triggers = addWorkflowCall(triggers, pipeline.inputs);
|
|
598
|
-
const jobs = lowerStepsWithCalls(reachableSteps, jobIdMap, pipeline.id);
|
|
628
|
+
const jobs = lowerStepsWithCalls(reachableSteps, jobIdMap, pipeline.id, config);
|
|
599
629
|
return assemblePipelineTarget(pipeline, triggers, jobs);
|
|
600
630
|
}
|
|
601
631
|
/**
|
|
@@ -805,13 +835,13 @@ function lowerInputs(inputs) {
|
|
|
805
835
|
* Call steps become `uses:` jobs (reusable workflow calls).
|
|
806
836
|
* Component steps become `uses:` jobs (composite action calls).
|
|
807
837
|
*/
|
|
808
|
-
function lowerStepsWithCalls(steps, jobIdMap, pipelineId) {
|
|
838
|
+
function lowerStepsWithCalls(steps, jobIdMap, pipelineId, config) {
|
|
809
839
|
return steps.map((step) => {
|
|
810
840
|
if (step.call) return lowerCallStep(step, jobIdMap, pipelineId);
|
|
811
|
-
if (step.component) return lowerComponentStep(step, jobIdMap);
|
|
841
|
+
if (step.component) return lowerComponentStep(step, jobIdMap, config);
|
|
812
842
|
if (step.childPipeline) return lowerChildPipelineStep$1(step, jobIdMap);
|
|
813
843
|
if (step.downstream) return lowerDownstreamStep$1(step, jobIdMap);
|
|
814
|
-
return lowerStep$1(step, jobIdMap);
|
|
844
|
+
return lowerStep$1(step, jobIdMap, config);
|
|
815
845
|
});
|
|
816
846
|
}
|
|
817
847
|
/**
|
|
@@ -862,7 +892,7 @@ function lowerCallStep(step, jobIdMap, pipelineId) {
|
|
|
862
892
|
* Lower a component step to a GitHub composite action call job.
|
|
863
893
|
* F-32: component → uses: org/component@version with `with:` inputs.
|
|
864
894
|
*/
|
|
865
|
-
function lowerComponentStep(step, jobIdMap) {
|
|
895
|
+
function lowerComponentStep(step, jobIdMap, config) {
|
|
866
896
|
const jobId = jobIdMap.get(step.id) ?? step.id;
|
|
867
897
|
const needs = lowerDependencies$1(step.dependencies, jobIdMap);
|
|
868
898
|
const comp = step.component;
|
|
@@ -873,14 +903,15 @@ function lowerComponentStep(step, jobIdMap) {
|
|
|
873
903
|
name: jobId,
|
|
874
904
|
runsOn: resolveRunsOn(step),
|
|
875
905
|
needs,
|
|
876
|
-
steps: [
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
906
|
+
steps: [
|
|
907
|
+
checkoutStep(config),
|
|
908
|
+
...setupSteps(config),
|
|
909
|
+
{
|
|
910
|
+
name: `Component ${comp.name}`,
|
|
911
|
+
uses: `${comp.name}@${comp.version}`,
|
|
912
|
+
...Object.keys(withMap).length > 0 ? { with: withMap } : {}
|
|
913
|
+
}
|
|
914
|
+
]
|
|
884
915
|
};
|
|
885
916
|
return {
|
|
886
917
|
id: jobId,
|
|
@@ -940,16 +971,12 @@ function lowerDownstreamStep$1(step, jobIdMap) {
|
|
|
940
971
|
/**
|
|
941
972
|
* Lower a single Step to a GitHub job.
|
|
942
973
|
*/
|
|
943
|
-
function lowerStep$1(step, jobIdMap) {
|
|
974
|
+
function lowerStep$1(step, jobIdMap, config) {
|
|
944
975
|
const needs = lowerDependencies$1(step.dependencies, jobIdMap);
|
|
945
|
-
const rawSteps = lowerOperations$1(step, jobIdMap);
|
|
976
|
+
const rawSteps = lowerOperations$1(step, jobIdMap, config);
|
|
946
977
|
if (step.continueOnError !== void 0 && typeof step.continueOnError !== "boolean") throw new GithubTargetError("GitHub does not support exit-code continueOnError; use a boolean value", "UNSUPPORTED_FEATURE");
|
|
947
|
-
const steps = step
|
|
948
|
-
...s,
|
|
949
|
-
continueOnError: typeof step.continueOnError === "boolean" ? step.continueOnError : true
|
|
950
|
-
} : s) : [...rawSteps];
|
|
978
|
+
const steps = applyContinueOnError(rawSteps, step, config);
|
|
951
979
|
const jobId = jobIdMap.get(step.id) ?? step.id;
|
|
952
|
-
applyDelay(steps, step);
|
|
953
980
|
const runtime = step.runtime;
|
|
954
981
|
const mode = runtime.mode ?? "host";
|
|
955
982
|
return assembleGithubJob({
|
|
@@ -964,12 +991,25 @@ function lowerStep$1(step, jobIdMap) {
|
|
|
964
991
|
});
|
|
965
992
|
}
|
|
966
993
|
/**
|
|
994
|
+
* Apply continueOnError to the step's own run commands. Injected setup
|
|
995
|
+
* stays fail-fast — a failed dependency install must not be ignored.
|
|
996
|
+
*/
|
|
997
|
+
function applyContinueOnError(rawSteps, step, config) {
|
|
998
|
+
const infraSteps = new Set(setupSteps(config));
|
|
999
|
+
return rawSteps.map((s) => step.continueOnError !== void 0 && s.run !== void 0 && !infraSteps.has(s) ? {
|
|
1000
|
+
...s,
|
|
1001
|
+
continueOnError: typeof step.continueOnError === "boolean" ? step.continueOnError : true
|
|
1002
|
+
} : s);
|
|
1003
|
+
}
|
|
1004
|
+
/**
|
|
967
1005
|
* Insert a sleep step to emulate delay (GitHub has no native delayed execution).
|
|
1006
|
+
* Called after checkout + setup steps are pushed, so the delay precedes the
|
|
1007
|
+
* step's own work but does not postpone toolchain setup.
|
|
968
1008
|
*/
|
|
969
1009
|
function applyDelay(steps, step) {
|
|
970
1010
|
if (!step.delay) return;
|
|
971
1011
|
const sleepSeconds = parseDurationToSeconds(step.delay);
|
|
972
|
-
|
|
1012
|
+
steps.push({
|
|
973
1013
|
name: `Delay (${step.delay})`,
|
|
974
1014
|
run: `sleep ${sleepSeconds}`
|
|
975
1015
|
});
|
|
@@ -1181,13 +1221,11 @@ function lowerDependencies$1(deps, jobIdMap) {
|
|
|
1181
1221
|
* Map operations to GitHub steps in original order.
|
|
1182
1222
|
* Consecutive shell/exportOutput operations are combined into one run step.
|
|
1183
1223
|
*/
|
|
1184
|
-
function lowerOperations$1(step, jobIdMap) {
|
|
1224
|
+
function lowerOperations$1(step, jobIdMap, config) {
|
|
1185
1225
|
const steps = [];
|
|
1186
1226
|
const shortStepId = step.id.includes("/") ? step.id.split("/").pop() : step.id;
|
|
1187
|
-
steps.push(
|
|
1188
|
-
|
|
1189
|
-
uses: "actions/checkout@v4"
|
|
1190
|
-
});
|
|
1227
|
+
steps.push(checkoutStep(config), ...setupSteps(config));
|
|
1228
|
+
applyDelay(steps, step);
|
|
1191
1229
|
if (step.runtime.network && step.runtime.network.allowed.length > 0) steps.push({
|
|
1192
1230
|
name: "Sverka network allowlist",
|
|
1193
1231
|
run: `echo "# sverka:network-allowlist: ${step.runtime.network.allowed.join(",")}"`
|
|
@@ -1583,7 +1621,12 @@ function stringifyTargetGraph$1(graph, options) {
|
|
|
1583
1621
|
const jobs = {};
|
|
1584
1622
|
for (const job of graph.jobs) jobs[job.id] = jobToYaml$1(job, options);
|
|
1585
1623
|
doc.jobs = jobs;
|
|
1586
|
-
|
|
1624
|
+
let yaml = stringify(doc, {
|
|
1625
|
+
sortMapEntries: false,
|
|
1626
|
+
aliasDuplicateObjects: false
|
|
1627
|
+
});
|
|
1628
|
+
yaml = yaml.replaceAll(/^(\s*uses:\s*)["']([^"']+@[0-9a-f]{40}) # ([^"']+)["']$/gm, "$1$2 # $3");
|
|
1629
|
+
return yaml;
|
|
1587
1630
|
}
|
|
1588
1631
|
/**
|
|
1589
1632
|
* Convert a GithubJob to a YAML-compatible object.
|
|
@@ -1661,6 +1704,7 @@ var pinned_actions_default = {
|
|
|
1661
1704
|
"actions/cache/restore@v4": "0057852bfaa89a56745cba8c7296529d2fc39830",
|
|
1662
1705
|
"actions/cache/save@v4": "0057852bfaa89a56745cba8c7296529d2fc39830",
|
|
1663
1706
|
"oven-sh/setup-bun@v2": "0c5077e51419868618aeaa5fe8019c62421857d6",
|
|
1707
|
+
"pnpm/action-setup@v4": "b906affcce14559ad1aafd4ab0e942779e9f58b1",
|
|
1664
1708
|
"softprops/action-gh-release@v2": "3bb12739c298aeb8a4eeaf626c5b8d85266b0e65",
|
|
1665
1709
|
"actions/upload-pages-artifact@v3": "56afc609e74202658d3ffba0e8f6dda462b719fa",
|
|
1666
1710
|
"actions/deploy-pages@v4": "d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e",
|
|
@@ -1710,10 +1754,12 @@ var GithubTarget = class {
|
|
|
1710
1754
|
capabilities = githubCapabilities;
|
|
1711
1755
|
pinningMode;
|
|
1712
1756
|
pinningRegistry;
|
|
1757
|
+
config;
|
|
1713
1758
|
constructor(config) {
|
|
1714
1759
|
const pinning = config?.pinning;
|
|
1715
1760
|
this.pinningMode = pinning?.mode ?? "off";
|
|
1716
1761
|
this.pinningRegistry = pinning?.registry ?? loadBundledRegistry();
|
|
1762
|
+
this.config = config;
|
|
1717
1763
|
}
|
|
1718
1764
|
/**
|
|
1719
1765
|
* Analyze a Definition Graph against the GitHub capability manifest.
|
|
@@ -1733,7 +1779,7 @@ var GithubTarget = class {
|
|
|
1733
1779
|
* with reusable workflow calls return one per pipeline.
|
|
1734
1780
|
*/
|
|
1735
1781
|
lower(graph) {
|
|
1736
|
-
return lowerGithub(graph);
|
|
1782
|
+
return lowerGithub(graph, this.config);
|
|
1737
1783
|
}
|
|
1738
1784
|
/**
|
|
1739
1785
|
* Emit one or more GithubTargetGraphs as YAML artifacts.
|
|
@@ -1809,8 +1855,8 @@ function collectUsesRefs(job) {
|
|
|
1809
1855
|
/**
|
|
1810
1856
|
* Convenience function: analyze → lower → emit in one call.
|
|
1811
1857
|
*/
|
|
1812
|
-
function compileGithub(graph) {
|
|
1813
|
-
return new GithubTarget().compile(graph);
|
|
1858
|
+
function compileGithub(graph, config) {
|
|
1859
|
+
return new GithubTarget(config).compile(graph);
|
|
1814
1860
|
}
|
|
1815
1861
|
//#endregion
|
|
1816
1862
|
//#region src/gitlab/capabilities.ts
|