/
auto-args.ts
206 lines (181 loc) · 5.02 KB
/
auto-args.ts
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
206
import {
AuthorInformation,
RepoInformation,
GithubInformation,
LogOptions,
ReleaseCalculationOptions,
} from "./types";
export interface ICreateLabelsOptions {
/** Do not actually do anything */
dryRun?: boolean;
}
export interface ILabelOptions {
/** PR to get the labels for */
pr?: number;
/** Label to check for */
exists?: string;
}
export interface IPRCheckOptions {
/** PR to check the label for */
pr?: number;
/** URL to attach to the checkmark */
url?: string;
/** The context the check should be attached to */
context?: string;
/** Do not actually do anything */
dryRun?: boolean;
}
export interface IPRStatusOptions {
/** The commit to attach a check to */
sha?: string;
/** The pr to attach a check to */
pr?: number;
/** URL to attach to the checkmark */
url: string;
/** The state to set the checkmark to */
state: "pending" | "success" | "error" | "failure";
/** The description to attach to the checkmark */
description: string;
/** The context the check should be attached to */
context: string;
/** Do not actually do anything */
dryRun?: boolean;
}
export type IVersionOptions = ReleaseCalculationOptions & {
/** Commit to start calculating the version from */
from?: string;
};
export interface QuietOption {
/** Print **only** the result of the command */
quiet?: boolean;
}
interface NoVersionPrefix {
/** Whether to prefix the version with a "v" */
noVersionPrefix?: boolean;
}
export interface DryRunOption {
/** Do not actually do anything */
dryRun?: boolean;
}
interface ChangelogMessage {
/** The commit message to commit the changelog changes with */
message?: string;
}
interface ChangelogTitle {
/** Override the title use in the addition to the CHANGELOG.md. */
title?: string;
}
interface Prerelease {
/** Create a prerelease */
prerelease?: boolean;
}
interface BaseBranch {
/** The branch to treat as the base */
baseBranch?: string;
}
export type IChangelogOptions = BaseBranch &
ChangelogTitle &
ChangelogMessage &
QuietOption &
DryRunOption &
NoVersionPrefix &
Partial<AuthorInformation> & {
/** Commit to start calculating the changelog from */
from?: string;
/** Commit to start calculating the changelog to */
to?: string;
/** Don't commit the changelog */
noCommit?: boolean;
};
export type IReleaseOptions = BaseBranch &
Prerelease &
DryRunOption &
NoVersionPrefix &
Partial<AuthorInformation> &
Partial<RepoInformation> & {
/** Commit to start calculating the release from */
from?: string;
/** Commit to calculate the release to */
to?: string;
/** Override the version to release */
useVersion?: string;
};
export type ICommentOptions = DryRunOption & {
/** The message to use when commenting */
message?: string;
/** THe PR to comment on */
pr?: number;
/** The context the message should be attached to. Use to post multiple comments to a PR */
context?: string;
/** Delete the previous comment */
delete?: boolean;
/** Instead of deleting/adding a new comment. Just edit the old one */
edit?: boolean;
};
export type IPRBodyOptions = Omit<ICommentOptions, "edit" | "delete">;
export type ILatestOptions = BaseBranch &
DryRunOption &
Partial<AuthorInformation> &
Prerelease &
NoVersionPrefix &
ChangelogTitle &
ChangelogMessage &
QuietOption &
ReleaseCalculationOptions & {
/** Skip creating the changelog */
noChangelog?: boolean;
};
export type IShipItOptions = ILatestOptions & {
/**
* Make auto publish prerelease versions when merging to baseBranch.
* Only PRs merged with "release" label will generate a "latest" release.
* Only use this flag if you do not want to maintain a prerelease branch,
* and instead only want to use baseBranch.
*/
onlyGraduateWithReleaseLabel?: boolean;
};
interface ForceOption {
/** Always deploy even if marked as skip release */
force?: boolean;
}
export type ICanaryOptions = QuietOption & ForceOption & {
/** Do not actually do anything */
dryRun?: boolean;
/** THe PR to attach the canary to */
pr?: number;
/** The build to attach the canary to */
build?: number;
/** The message used when attaching the canary version to a PR */
message?: string | "false";
};
export type INextOptions = QuietOption & ForceOption & {
/** Do not actually do anything */
dryRun?: boolean;
/** The message used when attaching the prerelease version to a PR */
message?: string;
};
export interface IInfoOptions {
/** List some of the available plugins */
listPlugins?: boolean;
}
export type GlobalOptions = {
/** Plugins to initialize "auto" with */
plugins?: string[];
} & Partial<GithubInformation & RepoInformation> &
LogOptions;
export type ApiOptions = GlobalOptions &
(
| ILatestOptions
| IInfoOptions
| ICreateLabelsOptions
| ILabelOptions
| IPRCheckOptions
| IPRStatusOptions
| ICommentOptions
| IChangelogOptions
| IPRBodyOptions
| IReleaseOptions
| IVersionOptions
| ICanaryOptions
| IShipItOptions
);