-
-
Notifications
You must be signed in to change notification settings - Fork 301
/
Copy pathLint.ts
35 lines (32 loc) · 1.14 KB
/
Lint.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
import { BaseResource } from '@gitbeaker/requester-utils';
import { RequestHelper, endpoint } from '../infrastructure';
import type { GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure';
export interface LintSchema extends Record<string, unknown> {
valid: boolean;
merged_yaml?: string;
errors?: string[];
warnings?: string[];
}
export class Lint<C extends boolean = false> extends BaseResource<C> {
check<E extends boolean = false>(
projectId: string | number,
options: { ref?: string; includeJobs?: boolean; dryRun?: boolean } & Sudo & ShowExpanded<E>,
): Promise<GitlabAPIResponse<LintSchema, C, E, void>> {
return RequestHelper.get<LintSchema>()(this, endpoint`projects/${projectId}/ci/lint`, options);
}
lint<E extends boolean = false>(
projectId: string | number,
content: string,
options?: {
ref?: string;
includeJobs?: boolean;
dryRun?: boolean;
} & Sudo &
ShowExpanded<E>,
): Promise<GitlabAPIResponse<LintSchema, C, E, void>> {
return RequestHelper.post<LintSchema>()(this, endpoint`projects/${projectId}/ci/lint`, {
...options,
content,
});
}
}