File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 1+ export type EventName = "push" | "pull_request" | "workflow_dispatch" ;
2+
3+ export type On =
4+ | EventName
5+ | EventName [ ]
6+ // TODO: implement
7+ | {
8+ push : {
9+ branches ?: string [ ] ;
10+ } ;
11+ } ;
Original file line number Diff line number Diff line change 11import { Job } from "./job" ;
2+ import type { On } from "./on" ;
23import type { Permissions } from "./permission" ;
34
45export type WorkflowConfig = {
56 name : string ;
7+ on : On ;
68 permissions ?: Permissions ;
79} ;
810
911export class Workflow {
1012 private readonly _config : WorkflowConfig ;
1113 private readonly _jobs : Record < string , Job > = { } ;
1214
13- public constructor ( name : string , config ? : Omit < WorkflowConfig , "name" > ) {
15+ public constructor ( name : string , config : Omit < WorkflowConfig , "name" > ) {
1416 this . _config = { name, ...config } ;
1517 }
1618
@@ -23,7 +25,7 @@ export class Workflow {
2325 return {
2426 name : this . _config . name ,
2527 permissions : this . _config . permissions ,
26- on : { push : { } } , // TODO: from config
28+ on : this . _config . on ,
2729 jobs : Object . fromEntries (
2830 Object . entries ( this . _jobs ) . map ( ( [ name , job ] ) => [ name , job . toJSON ( ) ] ) ,
2931 ) ,
You can’t perform that action at this time.
0 commit comments