-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathworkflow-template.ts
More file actions
205 lines (173 loc) · 4.68 KB
/
workflow-template.ts
File metadata and controls
205 lines (173 loc) · 4.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
import {
BasicExpressionToken,
MappingToken,
ScalarToken,
SequenceToken,
StringToken,
TemplateToken
} from "../templates/tokens/index.js";
export type WorkflowTemplate = {
events: EventsConfig;
jobs: WorkflowJob[];
concurrency: TemplateToken;
env: TemplateToken;
errors?: {
Message: string;
}[];
};
export type ConcurrencySetting = {
group?: StringToken;
cancelInProgress?: boolean;
};
export type ActionsEnvironmentReference = {
name?: TemplateToken;
url?: TemplateToken;
skipDeployment?: boolean;
};
export type WorkflowJob = Job | ReusableWorkflowJob;
export type JobType = "job" | "reusableWorkflowJob";
export type BaseJob = {
type: JobType;
id: StringToken;
name?: ScalarToken;
needs?: StringToken[];
if: BasicExpressionToken;
concurrency?: TemplateToken;
strategy?: TemplateToken;
outputs?: MappingToken;
snapshot?: TemplateToken;
};
// `job-factory` in the schema
export type Job = BaseJob & {
type: "job";
env?: MappingToken;
environment?: TemplateToken;
"runs-on"?: TemplateToken;
container?: TemplateToken;
services?: TemplateToken;
steps: Step[];
};
// `workflow-job` in the schema
export type ReusableWorkflowJob = BaseJob & {
type: "reusableWorkflowJob";
ref: StringToken;
"input-definitions"?: MappingToken;
"input-values"?: MappingToken;
"secret-definitions"?: MappingToken;
"secret-values"?: MappingToken;
"inherit-secrets"?: boolean;
jobs?: WorkflowJob[];
};
export type Container = {
image: StringToken;
credentials?: Credential;
env?: MappingToken;
ports?: SequenceToken;
volumes?: SequenceToken;
options?: StringToken;
};
export type Credential = {
username: StringToken | undefined;
password: StringToken | undefined;
};
export type Step = ActionStep | RunStep;
type BaseStep = {
id: string;
name?: ScalarToken;
if: BasicExpressionToken;
"continue-on-error"?: boolean | ScalarToken;
env?: MappingToken;
};
export type RunStep = BaseStep & {
run: ScalarToken;
};
export type ActionStep = BaseStep & {
uses: StringToken;
};
export type EventsConfig = {
schedule?: ScheduleConfig[];
workflow_dispatch?: WorkflowDispatchConfig;
workflow_call?: WorkflowCallConfig;
// Events that support filters
pull_request?: BranchFilterConfig & PathFilterConfig & TypesFilterConfig;
pull_request_target?: BranchFilterConfig & PathFilterConfig & TypesFilterConfig;
push?: BranchFilterConfig & TagFilterConfig & PathFilterConfig;
workflow_run?: WorkflowFilterConfig & BranchFilterConfig & TypesFilterConfig;
// Events that only support activity types
branch_protection_rule?: TypesFilterConfig;
check_run?: TypesFilterConfig;
check_suite?: TypesFilterConfig;
disccusion?: TypesFilterConfig;
disccusion_comment?: TypesFilterConfig;
issue_comment?: TypesFilterConfig;
issues?: TypesFilterConfig;
label?: TypesFilterConfig;
merge_group?: TypesFilterConfig;
milestone?: TypesFilterConfig;
project?: TypesFilterConfig;
project_card?: TypesFilterConfig;
project_column?: TypesFilterConfig;
pull_request_review?: TypesFilterConfig;
pull_request_review_comment?: TypesFilterConfig;
registry_package?: TypesFilterConfig;
repository_dispatch?: TypesFilterConfig;
release?: TypesFilterConfig;
watch?: TypesFilterConfig;
image_versions?: TypesFilterConfig & VersionsFilterConfig & NamesFilterConfig;
// Index signature to allow easier lookup
[eventName: string]: unknown;
};
export type TypesFilterConfig = {
types?: string[];
};
export type VersionsFilterConfig = {
versions?: string[];
};
export type NamesFilterConfig = {
names?: string[];
};
export type BranchFilterConfig = {
branches?: string[];
"branches-ignore"?: string[];
};
export type TagFilterConfig = {
tags?: string[];
"tags-ignore"?: string[];
};
export type PathFilterConfig = {
paths?: string[];
"paths-ignore"?: string[];
};
export type WorkflowDispatchConfig = {
inputs?: {[inputName: string]: InputConfig};
};
export type WorkflowCallConfig = {
inputs?: {[inputName: string]: InputConfig & {default?: string | boolean | number | ScalarToken}};
secrets?: {[secretName: string]: SecretConfig};
// TODO - these are supported in C# and Go but not in TS yet
// outputs: { [outputName: string]: OutputConfig }
};
export enum InputType {
string = "string",
choice = "choice",
boolean = "boolean",
environment = "environment"
}
export type InputConfig = {
type: InputType;
description?: string;
required?: boolean;
default?: string | boolean | number;
options?: string[];
};
export type SecretConfig = {
description?: string;
required?: boolean;
};
export type ScheduleConfig = {
cron: string;
timezone?: string;
};
export type WorkflowFilterConfig = {
workflows?: string[];
};