File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed
Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import { type Permissions, permissionJSON } from "./permission";
22import { type RunStep , type Step , stepJSON , type UsesStep } from "./step" ;
33
44export type JobConfig = {
5- id : string ;
65 runsOn : string ;
76 permissions ?: Permissions ;
87 timeoutMinutes ?: number ;
@@ -12,15 +11,17 @@ export type JobConfig = {
1211} ;
1312
1413export 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 {
Original file line number Diff line number Diff line change @@ -4,19 +4,20 @@ import { type On, onJSON } from "./on";
44import type { Permissions } from "./permission" ;
55
66export type WorkflowConfig = {
7- name : string ;
87 runName ?: string ;
98 concurrency ?: Concurrency ;
109 on : On ;
1110 permissions ?: Permissions ;
1211} ;
1312
1413export 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
You can’t perform that action at this time.
0 commit comments