UNPKG

2 kBTypeScriptView Raw
1import GHub from '@octokit/rest';
2import { ICommit } from 'gitlog';
3import { ILogger } from './utils/logger';
4declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>> & Partial<Pick<T, K>>;
5export declare type IPRInfo = Omit<GHub.ReposCreateStatusParams, 'owner' | 'repo'>;
6export interface IGitOptions {
7 owner: string;
8 repo: string;
9 baseUrl?: string;
10 token?: string;
11}
12export declare function getRandomColor(): string;
13export default class Git {
14 readonly options: IGitOptions;
15 private readonly baseUrl;
16 private readonly ghub;
17 private readonly logger;
18 constructor(options: IGitOptions, logger?: ILogger);
19 getLatestReleaseInfo(): Promise<GHub.ReposGetLatestReleaseResponse>;
20 getLatestRelease(): Promise<string>;
21 getCommitDate(sha: string): Promise<string>;
22 getFirstCommit(): Promise<string>;
23 getSha(): Promise<string>;
24 getLabels(prNumber: number): Promise<string[]>;
25 getProjectLabels(): Promise<string[]>;
26 getGitLog(start: string, end?: string): Promise<ICommit[]>;
27 getUserByEmail(email: string): Promise<any>;
28 getUserByUsername(username: string): Promise<GHub.UsersGetByUsernameResponse>;
29 getPullRequest(pr: number): Promise<GHub.Response<GHub.PullsGetResponse>>;
30 searchRepo(options: GHub.SearchIssuesAndPullRequestsParams): Promise<any>;
31 createStatus(prInfo: IPRInfo): Promise<GHub.Response<GHub.ReposCreateStatusResponse>>;
32 createLabel(label: string, name: string): Promise<GHub.Response<GHub.IssuesCreateLabelResponse>>;
33 getProject(): Promise<GHub.ReposGetResponse>;
34 getPullRequests(options?: Partial<GHub.PullsListParams>): Promise<GHub.PullsListResponseItem[]>;
35 getCommitsForPR(pr: number): Promise<GHub.PullsListCommitsResponseItem[]>;
36 createComment(message: string, pr: number, context?: string): Promise<GHub.Response<GHub.IssuesCreateCommentResponse>>;
37 publish(releaseNotes: string, tag: string): Promise<GHub.Response<GHub.ReposCreateReleaseResponse>>;
38}
39export {};