Skip to content

Commit 6938b38

Browse files
authored
feat(job): Support continue-on-error (#43)
1 parent 2415fcb commit 6938b38

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

lib/package/job.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,28 @@ describe("Job", () => {
130130
steps: [{ run: "echo 'Hello, world!'" }],
131131
},
132132
],
133+
[
134+
new Job("with-continue-on-error", {
135+
runsOn: "ubuntu-latest",
136+
continueOnError: true,
137+
}).run("echo 'Hello, world!'"),
138+
{
139+
"runs-on": "ubuntu-latest",
140+
"continue-on-error": true,
141+
steps: [{ run: "echo 'Hello, world!'" }],
142+
},
143+
],
144+
[
145+
new Job("with-continue-on-error", {
146+
runsOn: "ubuntu-latest",
147+
continueOnError: "${{ foo }}",
148+
}).run("echo 'Hello, world!'"),
149+
{
150+
"runs-on": "ubuntu-latest",
151+
"continue-on-error": "${{ foo }}",
152+
steps: [{ run: "echo 'Hello, world!'" }],
153+
},
154+
],
133155
])("job.toJSON(%j) -> %j", (job, expected) => {
134156
expect(job.toJSON()).toEqual(expected);
135157
});

lib/package/job.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export type JobConfig = {
2323
// TODO: env
2424
defaults?: Defaults;
2525
// TODO: strategy
26-
// TODO: continue-on-error
26+
continueOnError?: boolean | Expression;
2727
// TODO: container
2828
// TODO: services
2929
// TODO: uses
@@ -99,6 +99,10 @@ export class Job {
9999
defaults: defaultsJSON(this._config.defaults),
100100
}),
101101

102+
...(this._config.continueOnError != null && {
103+
"continue-on-error": this._config.continueOnError,
104+
}),
105+
102106
steps: this._steps.map((step) => stepJSON(step)),
103107
};
104108
}

0 commit comments

Comments
 (0)