act-test-runner 2.0.0

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.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +56 -0
  3. package/dist/ActExecStatus.d.ts +28 -0
  4. package/dist/ActExecStatus.js +29 -0
  5. package/dist/ActJobExecResult.d.ts +39 -0
  6. package/dist/ActJobExecResult.js +42 -0
  7. package/dist/ActOutputListener.d.ts +58 -0
  8. package/dist/ActOutputListener.js +45 -0
  9. package/dist/ActResourceSpec.d.ts +6 -0
  10. package/dist/ActRunner.d.ts +168 -0
  11. package/dist/ActRunner.js +304 -0
  12. package/dist/ActRunnerError.d.ts +25 -0
  13. package/dist/ActRunnerError.js +25 -0
  14. package/dist/ActRunnerOptions.d.ts +57 -0
  15. package/dist/ActRunnerOptions.js +22 -0
  16. package/dist/ActRunnerResult.d.ts +68 -0
  17. package/dist/ActRunnerResult.js +33 -0
  18. package/dist/ActWorkflowExecResult.d.ts +45 -0
  19. package/dist/ActWorkflowExecResult.js +49 -0
  20. package/dist/index.d.ts +27 -0
  21. package/dist/index.js +24 -0
  22. package/dist/internal/ActCliParams.d.ts +57 -0
  23. package/dist/internal/ActCliParams.js +119 -0
  24. package/dist/internal/ActExecListener.d.ts +37 -0
  25. package/dist/internal/ActExecListener.js +98 -0
  26. package/dist/internal/ActJobExecResultBuilder.d.ts +33 -0
  27. package/dist/internal/ActJobExecResultBuilder.js +52 -0
  28. package/dist/internal/ActJobOutputProcessor.d.ts +40 -0
  29. package/dist/internal/ActJobOutputProcessor.js +101 -0
  30. package/dist/internal/ActJsonOutput.d.ts +39 -0
  31. package/dist/internal/ActJsonOutput.js +53 -0
  32. package/dist/internal/ActResourceSpec.d.ts +26 -0
  33. package/dist/internal/ActResourceSpec.js +30 -0
  34. package/dist/internal/ActStepOutputProcessor.d.ts +32 -0
  35. package/dist/internal/ActStepOutputProcessor.js +51 -0
  36. package/dist/internal/JobIterationTracker.d.ts +27 -0
  37. package/dist/internal/JobIterationTracker.js +41 -0
  38. package/dist/internal/JobTrackingActExecListener.d.ts +34 -0
  39. package/dist/internal/JobTrackingActExecListener.js +74 -0
  40. package/dist/internal/OutputForwardingActExecListener.d.ts +30 -0
  41. package/dist/internal/OutputForwardingActExecListener.js +40 -0
  42. package/dist/utils/checks.d.ts +23 -0
  43. package/dist/utils/checks.js +38 -0
  44. package/dist/utils/fsutils.d.ts +27 -0
  45. package/dist/utils/fsutils.js +43 -0
  46. package/dist/utils/objects.d.ts +22 -0
  47. package/dist/utils/objects.js +25 -0
  48. package/dist/utils/types.d.ts +24 -0
  49. package/dist/utils/types.js +22 -0
  50. package/package.json +72 -0
@@ -0,0 +1,304 @@
1
+ /**
2
+ * Copyright (c) 2026 original authors
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ import { spawn } from 'node:child_process';
23
+ import { CompositeActOutputListener, StdStreamOutputListener, } from './ActOutputListener.js';
24
+ import { ActExecStatus, ActRunnerError } from './ActRunnerResult.js';
25
+ import { ActCliParams, INTERNAL_ACT_PARAMS, MANAGED_ACT_PARAMS, } from './internal/ActCliParams.js';
26
+ import { ActExecListener } from './internal/ActExecListener.js';
27
+ import { checkExists, checkOneDefined } from './utils/checks.js';
28
+ import { cleanupDir, createTempDir, createTempEventPayloadFile, createTempWorkflowFile, } from './utils/fsutils.js';
29
+ import { firstDefined } from './utils/objects.js';
30
+ /**
31
+ * Invokes `act`, allowing end-to-end testing of custom GitHub actions and
32
+ * workflows.
33
+ *
34
+ * Typically, the test code will provide a workflow file or workflow body to
35
+ * run, as well as required workflow inputs, such as environment variables or
36
+ * secrets.
37
+ *
38
+ * Assertions can then be made on the outcome of the `run()` method invocation,
39
+ * such as the jobs run, workflow output, or artifacts persisted in the artifact
40
+ * server or action cache.
41
+ *
42
+ * The runner cannot be used concurrently due to limitations on the `act` side.
43
+ *
44
+ * Each instance is single-use: calling `run()` more than once on the same
45
+ * instance rejects with an `ActRunnerError`. Create a new instance for each
46
+ * run.
47
+ */
48
+ export class ActRunner {
49
+ actExecutable;
50
+ workingDir;
51
+ workflowSource;
52
+ eventType;
53
+ eventPayloadFileOrBody;
54
+ envSource;
55
+ inputsSource;
56
+ secretsSource;
57
+ variablesSource;
58
+ matrixValues;
59
+ cacheServer;
60
+ artifactServer;
61
+ additionalArgs = [];
62
+ outputListener;
63
+ hasRun = false;
64
+ /**
65
+ * Sets the path to the `act` executable (default: `act` binary on the
66
+ * `PATH`). Useful in the CI environments, where the executable is provisioned
67
+ * on demand in a controlled location.
68
+ *
69
+ * @param actExecutable - Path to the `act` executable.
70
+ */
71
+ withActExecutable(actExecutable) {
72
+ this.actExecutable = actExecutable;
73
+ return this;
74
+ }
75
+ /**
76
+ * Sets the directory to use for the runner's storage needs (default:
77
+ * directory in user's temp folder).
78
+ *
79
+ * @param {string} workingDir - The runner's working directory
80
+ */
81
+ withWorkingDir(workingDir) {
82
+ this.workingDir = workingDir;
83
+ return this;
84
+ }
85
+ /**
86
+ * Specifies the GitHub workflow to run, either as a file path or an inline
87
+ * body.
88
+ *
89
+ * @param source - The workflow source
90
+ */
91
+ withWorkflow(source) {
92
+ this.workflowSource = source;
93
+ return this;
94
+ }
95
+ /**
96
+ * Configures the event that triggers the workflow run (e.g., `push`). If
97
+ * unspecified, the first event type specified in the workflow definition will
98
+ * be used.
99
+ *
100
+ * @param type - Type of the event to trigger the workflow
101
+ * @param payloadFileOrBody - Event payload as plain JS object or path to the
102
+ * JSON file
103
+ */
104
+ withEvent(type, payloadFileOrBody) {
105
+ this.eventType = type;
106
+ this.eventPayloadFileOrBody = payloadFileOrBody;
107
+ return this;
108
+ }
109
+ /**
110
+ * Specifies environment variables to use when invoking the given workflow,
111
+ * provided via a file, inline values, or both. Replaces any environment
112
+ * variables set by a previous call to this method.
113
+ *
114
+ * @param source - Environment variables source
115
+ */
116
+ withEnv(source) {
117
+ this.envSource = source;
118
+ return this;
119
+ }
120
+ /**
121
+ * Specifies inputs values to use when invoking the given workflow, provided
122
+ * via a file, inline values, or both. Replaces any inputs values set by a
123
+ * previous call to this method.
124
+ *
125
+ * @param source - Inputs values source
126
+ */
127
+ withInputs(source) {
128
+ this.inputsSource = source;
129
+ return this;
130
+ }
131
+ /**
132
+ * Specifies secrets values to use when invoking the given workflow, provided
133
+ * via a file, inline values, or both. Replaces any secrets values set by a
134
+ * previous call to this method.
135
+ *
136
+ * @param source - Secrets values source
137
+ */
138
+ withSecrets(source) {
139
+ this.secretsSource = source;
140
+ return this;
141
+ }
142
+ /**
143
+ * Specifies workflow variables values to use when invoking the given
144
+ * workflow, provided via a file, inline values, or both. Replaces any
145
+ * variables values set by a previous call to this method.
146
+ *
147
+ * @param source - Variables values source
148
+ */
149
+ withVariables(source) {
150
+ this.variablesSource = source;
151
+ return this;
152
+ }
153
+ /**
154
+ * Set matrix values to run the workflow with. If undefined, all combinations
155
+ * specified in the workflow definition will be invoked. Replaces any matrix
156
+ * values set by a previous call to this method.
157
+ *
158
+ * @param matrixValues - Matrix values to run the workflow with
159
+ */
160
+ withMatrix(matrixValues) {
161
+ this.matrixValues = matrixValues;
162
+ return this;
163
+ }
164
+ /**
165
+ * Configures the cache server to be used by the given workflow.
166
+ *
167
+ * @param spec - Cache server configuration
168
+ */
169
+ withCacheServer(spec) {
170
+ this.cacheServer = spec;
171
+ return this;
172
+ }
173
+ /**
174
+ * Configures the artifact server to be used by the given workflow.
175
+ *
176
+ * @param spec - Artifact server configuration
177
+ */
178
+ withArtifactServer(spec) {
179
+ this.artifactServer = spec;
180
+ return this;
181
+ }
182
+ /**
183
+ * Arbitrary additional arguments to pass to the `act` execution.
184
+ *
185
+ * @param {...string} args - Additional arguments to invoke `act` with
186
+ */
187
+ withAdditionalArgs(...args) {
188
+ args.forEach((arg) => this.additionalArgs.push(arg));
189
+ return this;
190
+ }
191
+ /**
192
+ * Forwards the act output to the supplied listeners. When no listener is
193
+ * specified, forwards the output to the console.
194
+ *
195
+ * @param listeners - Output consumers.
196
+ */
197
+ forwardOutput(...listeners) {
198
+ this.outputListener =
199
+ listeners.length === 0
200
+ ? new StdStreamOutputListener()
201
+ : new CompositeActOutputListener(listeners);
202
+ return this;
203
+ }
204
+ /**
205
+ * Invokes `act` with specified options.
206
+ *
207
+ * @param options - Options controlling this run, such as an abort signal
208
+ * @returns Workflow execution result for inspection
209
+ */
210
+ run(options) {
211
+ return new Promise((resolve, reject) => {
212
+ try {
213
+ if (this.hasRun) {
214
+ throw new ActRunnerError('ActRunner instances cannot be reused; create a new instance for each run()');
215
+ }
216
+ this.hasRun = true;
217
+ const signal = options?.signal;
218
+ if (signal?.aborted) {
219
+ throw new ActRunnerError('act execution was aborted');
220
+ }
221
+ const params = this.validateRunnerParams();
222
+ const executionListener = new ActExecListener(this.outputListener);
223
+ // apply user arguments + additional internal arguments specific to test execution
224
+ const args = [...params.asCliArgs(), '--rm', '--json'];
225
+ const child = spawn(this.actExecutable ?? 'act', args);
226
+ const onAbort = () => {
227
+ child.kill();
228
+ };
229
+ signal?.addEventListener('abort', onAbort, { once: true });
230
+ child.stdout.on('data', (data) => executionListener.onRawOutput(data.toString().trimEnd()));
231
+ child.stderr.on('data', (data) => executionListener.onRawOutput(data.toString().trimEnd()));
232
+ child.on('close', (code) => {
233
+ signal?.removeEventListener('abort', onAbort);
234
+ cleanupDir(this.workingDir);
235
+ if (signal?.aborted) {
236
+ reject(new ActRunnerError('act execution was aborted'));
237
+ return;
238
+ }
239
+ resolve({
240
+ status: code === 0 ? ActExecStatus.SUCCESS : ActExecStatus.FAILED,
241
+ output: executionListener.getOutput(),
242
+ jobs: executionListener.getJobs(),
243
+ });
244
+ });
245
+ child.on('error', (err) => {
246
+ signal?.removeEventListener('abort', onAbort);
247
+ reject(new ActRunnerError(`Failed to launch act: ${err.message}`));
248
+ });
249
+ }
250
+ catch (err) {
251
+ if (err instanceof ActRunnerError) {
252
+ reject(err);
253
+ return;
254
+ }
255
+ reject(new ActRunnerError(`Unexpected error occurred when executing act: ${err}`));
256
+ }
257
+ });
258
+ }
259
+ validateRunnerParams() {
260
+ if (this.actExecutable) {
261
+ checkExists('act executable', this.actExecutable);
262
+ }
263
+ const workingDir = checkExists('working directory', firstDefined(() => this.workingDir, createTempDir));
264
+ this.workingDir = workingDir;
265
+ const workflowFile = this.workflowSource && 'file' in this.workflowSource
266
+ ? this.workflowSource.file
267
+ : undefined;
268
+ const workflowBody = this.workflowSource && 'body' in this.workflowSource
269
+ ? this.workflowSource.body
270
+ : undefined;
271
+ checkOneDefined(workflowFile, workflowBody);
272
+ const workflowFilePath = checkExists('workflow path', workflowFile ||
273
+ (workflowBody !== undefined
274
+ ? createTempWorkflowFile(workingDir, workflowBody)
275
+ : undefined));
276
+ const eventPayloadFileOrBody = this.eventPayloadFileOrBody;
277
+ const eventPayloadFilePath = typeof eventPayloadFileOrBody === 'object'
278
+ ? createTempEventPayloadFile(workingDir, eventPayloadFileOrBody)
279
+ : typeof eventPayloadFileOrBody === 'string'
280
+ ? eventPayloadFileOrBody
281
+ : undefined;
282
+ const overwrittenManagedParams = this.additionalArgs.filter((it) => MANAGED_ACT_PARAMS.has(it));
283
+ if (overwrittenManagedParams.length > 0) {
284
+ throw new ActRunnerError(`The following act arguments must be set via dedicated ActRunner methods, and not via 'withAdditionalArguments': ${overwrittenManagedParams}`);
285
+ }
286
+ const overwrittenInternalParams = this.additionalArgs.filter((it) => INTERNAL_ACT_PARAMS.has(it));
287
+ if (overwrittenInternalParams.length > 0) {
288
+ throw new ActRunnerError(`The following act arguments must not be set via 'withAdditionalArguments', as they are managed by the ActRunner: ${overwrittenInternalParams}`);
289
+ }
290
+ return new ActCliParams({
291
+ workflowsPath: workflowFilePath,
292
+ eventPayloadFilePath,
293
+ eventType: this.eventType,
294
+ envSource: this.envSource,
295
+ inputsSource: this.inputsSource,
296
+ secretsSource: this.secretsSource,
297
+ variablesSource: this.variablesSource,
298
+ matrixValues: this.matrixValues,
299
+ cacheServer: this.cacheServer,
300
+ artifactServer: this.artifactServer,
301
+ additionalArgs: this.additionalArgs,
302
+ });
303
+ }
304
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) 2025 original authors
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ * this software and associated documentation files (the "Software"), to deal in
6
+ * the Software without restriction, including without limitation the rights to
7
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ * the Software, and to permit persons to whom the Software is furnished to do so,
9
+ * subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ */
21
+ /**
22
+ * Error thrown if the `ActRunner` is mis-configured or if the runner encounters an unexpected error.
23
+ */
24
+ export declare class ActRunnerError extends Error {
25
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) 2025 original authors
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ * this software and associated documentation files (the "Software"), to deal in
6
+ * the Software without restriction, including without limitation the rights to
7
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ * the Software, and to permit persons to whom the Software is furnished to do so,
9
+ * subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ */
21
+ /**
22
+ * Error thrown if the `ActRunner` is mis-configured or if the runner encounters an unexpected error.
23
+ */
24
+ export class ActRunnerError extends Error {
25
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Copyright (c) 2026 original authors
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ /** Options controlling a single `run()` invocation. */
23
+ export type ActProcessOptions = {
24
+ /**
25
+ * Signal used to abort a running act invocation. On abort, the underlying act
26
+ * process is killed and the returned promise rejects with an ActRunnerError.
27
+ */
28
+ signal?: AbortSignal;
29
+ };
30
+ /**
31
+ * Source of key/value pairs (environment variables, inputs, secrets, or
32
+ * variables), provided via a file, inline values, or both.
33
+ */
34
+ export type ActValueSource = {
35
+ /** Path to a file containing the values. */
36
+ file?: string;
37
+ /** Inline values. */
38
+ values?: Record<string, string>;
39
+ };
40
+ /**
41
+ * Source of the GitHub workflow to run, provided either as a file path or
42
+ * inline body.
43
+ */
44
+ export type ActWorkflowSource = {
45
+ file: string;
46
+ } | {
47
+ body: string;
48
+ };
49
+ /** Configuration for the cache or artifact server used by a workflow run. */
50
+ export type ActResourceServerSpec = {
51
+ /** The path where the server's data will be stored. */
52
+ path: string;
53
+ /** The address to which the server binds. */
54
+ host?: string;
55
+ /** The port on which the server listens. */
56
+ port?: number;
57
+ };
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright (c) 2026 original authors
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ export {};
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Copyright (c) 2026 original authors
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ /** Matrix values a job ran with. */
23
+ export type ActMatrixValues = Record<string, string | number | boolean>;
24
+ /** Result of the workflow execution. */
25
+ export type ActWorkflowExecResult = {
26
+ /** Outcome of the workflow run. */
27
+ readonly status: ActExecStatus;
28
+ /** Workflow's console output. */
29
+ readonly output: string;
30
+ /** Jobs executed by the workflow, keyed by job name. */
31
+ readonly jobs: Record<string, ActJobExecResult>;
32
+ };
33
+ /** Outcome of the workflow or job execution. */
34
+ export declare const ActExecStatus: {
35
+ readonly SUCCESS: 'SUCCESS';
36
+ readonly FAILED: 'FAILED';
37
+ readonly SKIPPED: 'SKIPPED';
38
+ };
39
+ /** Outcome of the workflow or job execution. */
40
+ export type ActExecStatus = (typeof ActExecStatus)[keyof typeof ActExecStatus];
41
+ /** Job execution result for inspection. */
42
+ export type ActJobExecResult = {
43
+ /** Name of the job run. */
44
+ readonly name: string;
45
+ /** Result of the job execution. */
46
+ readonly status: ActExecStatus;
47
+ /** Job's console output. */
48
+ readonly output: string;
49
+ /** Matrix values the job ran with. */
50
+ readonly matrix: ActMatrixValues;
51
+ /** Steps executed by the job, in the order they ran. */
52
+ readonly steps: ActStepExecResult[];
53
+ };
54
+ /** Step execution result for inspection. */
55
+ export type ActStepExecResult = {
56
+ /** Name of the step run. */
57
+ readonly name: string;
58
+ /** Result of the step execution. */
59
+ readonly status: ActExecStatus;
60
+ /** Step's console output. */
61
+ readonly output: string;
62
+ };
63
+ /**
64
+ * Error thrown if the `ActRunner` is mis-configured or if the runner encounters
65
+ * an unexpected error.
66
+ */
67
+ export declare class ActRunnerError extends Error {
68
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Copyright (c) 2026 original authors
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ /** Outcome of the workflow or job execution. */
23
+ export const ActExecStatus = {
24
+ SUCCESS: 'SUCCESS',
25
+ FAILED: 'FAILED',
26
+ SKIPPED: 'SKIPPED',
27
+ };
28
+ /**
29
+ * Error thrown if the `ActRunner` is mis-configured or if the runner encounters
30
+ * an unexpected error.
31
+ */
32
+ export class ActRunnerError extends Error {
33
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Copyright (c) 2025 original authors
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ * this software and associated documentation files (the "Software"), to deal in
6
+ * the Software without restriction, including without limitation the rights to
7
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ * the Software, and to permit persons to whom the Software is furnished to do so,
9
+ * subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ */
21
+ import { ActExecStatus } from './ActExecStatus.js';
22
+ import { ActJobExecResult } from './ActJobExecResult.js';
23
+ /**
24
+ * Result of the workflow execution.
25
+ */
26
+ export declare class ActWorkflowExecResult {
27
+ /**
28
+ * Outcome of the workflow run.
29
+ */
30
+ readonly status: ActExecStatus;
31
+ /**
32
+ * Workflow's console output.
33
+ */
34
+ readonly output: string;
35
+ /**
36
+ * Jobs executed by the workflow.
37
+ */
38
+ readonly jobs: Map<String, ActJobExecResult>;
39
+ constructor(status: ActExecStatus, output: string, jobs: Map<String, ActJobExecResult>);
40
+ /**
41
+ * @param name - name of the job executed by the given workflow.
42
+ * @returns job - result of executing the given job in the context of the current workflow.
43
+ */
44
+ job(name: string): ActJobExecResult | undefined;
45
+ }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Copyright (c) 2025 original authors
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ * this software and associated documentation files (the "Software"), to deal in
6
+ * the Software without restriction, including without limitation the rights to
7
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ * the Software, and to permit persons to whom the Software is furnished to do so,
9
+ * subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in all
12
+ * copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
17
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
+ */
21
+ /**
22
+ * Result of the workflow execution.
23
+ */
24
+ export class ActWorkflowExecResult {
25
+ /**
26
+ * Outcome of the workflow run.
27
+ */
28
+ status;
29
+ /**
30
+ * Workflow's console output.
31
+ */
32
+ output;
33
+ /**
34
+ * Jobs executed by the workflow.
35
+ */
36
+ jobs;
37
+ constructor(status, output, jobs) {
38
+ this.status = status;
39
+ this.output = output;
40
+ this.jobs = jobs;
41
+ }
42
+ /**
43
+ * @param name - name of the job executed by the given workflow.
44
+ * @returns job - result of executing the given job in the context of the current workflow.
45
+ */
46
+ job(name) {
47
+ return this.jobs.get(name);
48
+ }
49
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright (c) 2026 original authors
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+ export { ActRunner } from './ActRunner.js';
23
+ export type { ActProcessOptions, ActValueSource, ActWorkflowSource, ActResourceServerSpec, } from './ActRunnerOptions.js';
24
+ export type { ActJobOrStepDescriptor as ActOutputOwner, ActOutputListener, ActOutput, } from './ActOutputListener.js';
25
+ export { ActOutputLevel, StdStreamOutputListener, } from './ActOutputListener.js';
26
+ export { ActExecStatus, ActRunnerError } from './ActRunnerResult.js';
27
+ export type { ActJobExecResult, ActMatrixValues, ActStepExecResult, ActWorkflowExecResult, } from './ActRunnerResult.js';