Skip to content

Commit cc4bf40

Browse files
committed
fix: Update interface
1 parent c0c17e6 commit cc4bf40

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

lib/package/job.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { type Permissions, permissionJSON } from "./permission";
22
import { type RunStep, type Step, stepJSON, type UsesStep } from "./step";
33

44
export type JobConfig = {
5-
id: string;
65
runsOn: string;
76
permissions?: Permissions;
87
timeoutMinutes?: number;
@@ -12,15 +11,17 @@ export type JobConfig = {
1211
};
1312

1413
export class Job {
14+
private readonly _id: string;
1515
private readonly _config: JobConfig;
1616
private readonly _steps: Step[] = [];
1717

18-
public constructor(id: string, config: Omit<JobConfig, "id">) {
19-
this._config = { id, ...config };
18+
public constructor(id: string, config: JobConfig) {
19+
this._id = id;
20+
this._config = config;
2021
}
2122

2223
public get id(): string {
23-
return this._config.id;
24+
return this._id;
2425
}
2526

2627
public run(command: string, params?: Omit<RunStep, "kind" | "command">): Job {

lib/package/workflow.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,20 @@ import { type On, onJSON } from "./on";
44
import type { Permissions } from "./permission";
55

66
export type WorkflowConfig = {
7-
name: string;
87
runName?: string;
98
concurrency?: Concurrency;
109
on: On;
1110
permissions?: Permissions;
1211
};
1312

1413
export class Workflow {
14+
private readonly _name: string;
1515
private readonly _config: WorkflowConfig;
1616
private readonly _jobs: Record<string, Job> = {};
1717

18-
public constructor(name: string, config: Omit<WorkflowConfig, "name">) {
19-
this._config = { name, ...config };
18+
public constructor(name: string, config: WorkflowConfig) {
19+
this._name = name;
20+
this._config = config;
2021
}
2122

2223
public addJob(...jobs: Job[]): Workflow {
@@ -28,7 +29,7 @@ export class Workflow {
2829

2930
public toJSON(): Record<string, unknown> {
3031
return {
31-
name: this._config.name,
32+
name: this._name,
3233

3334
"run-name": this._config.runName,
3435

0 commit comments

Comments
 (0)