1 | import Octokit from '@octokit/rest';
|
2 | import { ICommit } from 'gitlog';
|
3 | import HttpsProxyAgent from 'https-proxy-agent';
|
4 | import { ILabelDefinition } from './release';
|
5 | import { ILogger } from './utils/logger';
|
6 | declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>> & Partial<Pick<T, K>>;
|
7 | export declare type IPRInfo = Omit<Octokit.ReposCreateStatusParams, 'owner' | 'repo'>;
|
8 | export interface IGitOptions {
|
9 |
|
10 | owner: string;
|
11 |
|
12 | repo: string;
|
13 |
|
14 | baseUrl?: string;
|
15 |
|
16 | graphqlBaseUrl?: string;
|
17 |
|
18 | token?: string;
|
19 |
|
20 | agent?: HttpsProxyAgent;
|
21 | }
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | export default class Git {
|
27 |
|
28 | readonly github: Octokit;
|
29 |
|
30 | readonly options: IGitOptions;
|
31 |
|
32 | private readonly baseUrl;
|
33 |
|
34 | private readonly graphqlBaseUrl;
|
35 |
|
36 | private readonly logger;
|
37 |
|
38 | constructor(options: IGitOptions, logger?: ILogger);
|
39 | /** Get the "Latest Release" from GitHub */
|
40 | getLatestReleaseInfo(): Promise<Octokit.ReposGetLatestReleaseResponse>;
|
41 | /** Get the "Latest Release" or the first commit SHA as a fallback */
|
42 | getLatestRelease(): Promise<string>;
|
43 | /** Get the date a commit sha was created */
|
44 | getCommitDate(sha: string): Promise<string>;
|
45 | /** Get the first commit for the repo */
|
46 | getFirstCommit(): Promise<string>;
|
47 | /** Get the SHA of the latest commit */
|
48 | getSha(short?: boolean): Promise<string>;
|
49 | /** Get the labels for a PR */
|
50 | getLabels(prNumber: number): Promise<string[]>;
|
51 | /** Get all the information about a PR or issue */
|
52 | getPr(prNumber: number): Promise<Octokit.Response<Octokit.IssuesGetResponse>>;
|
53 | /** Get information about specific commit */
|
54 | getCommit(sha: string): Promise<Octokit.Response<Octokit.ReposGetCommitResponse>>;
|
55 | /** Get the labels for a the project */
|
56 | getProjectLabels(): Promise<string[]>;
|
57 | /** Get the git log for a range of commits */
|
58 | getGitLog(start: string, end?: string): Promise<ICommit[]>;
|
59 | /** Get the GitHub user for an email. Will not work if they do not have their email set to "public". */
|
60 | getUserByEmail(email: string): Promise<{} | undefined>;
|
61 |
|
62 | getUserByUsername(username: string): Promise<Octokit.UsersGetByUsernameResponse | undefined>;
|
63 |
|
64 | getPullRequest(pr: number): Promise<Octokit.Response<Octokit.PullsGetResponse>>;
|
65 |
|
66 | searchRepo(options: Octokit.SearchIssuesAndPullRequestsParams): Promise<Octokit.SearchIssuesAndPullRequestsResponse>;
|
67 |
|
68 | graphql(query: string): Promise<import("@octokit/graphql/dist-types/types").GraphQlQueryResponseData>;
|
69 |
|
70 | createStatus(prInfo: IPRInfo): Promise<Octokit.Response<Octokit.ReposCreateStatusResponse>>;
|
71 |
|
72 | createLabel(label: ILabelDefinition): Promise<Octokit.Response<Octokit.IssuesCreateLabelResponse>>;
|
73 |
|
74 | updateLabel(label: ILabelDefinition): Promise<Octokit.Response<Octokit.IssuesUpdateLabelResponse>>;
|
75 |
|
76 | addLabelToPr(pr: number, label: string): Promise<Octokit.Response<Octokit.IssuesAddLabelsResponse>>;
|
77 |
|
78 | removeLabel(pr: number, label: string): Promise<Octokit.Response<Octokit.IssuesRemoveLabelResponse>>;
|
79 |
|
80 | lockIssue(issue: number): Promise<Octokit.AnyResponse>;
|
81 |
|
82 | getProject(): Promise<Octokit.ReposGetResponse>;
|
83 |
|
84 | getPullRequests(options?: Partial<Octokit.PullsListParams>): Promise<Octokit.PullsListResponse>;
|
85 |
|
86 | getCommitsForPR(pr: number): Promise<Octokit.PullsListCommitsResponseItem[]>;
|
87 |
|
88 | getCommentId(pr: number, context?: string): Promise<number>;
|
89 |
|
90 | deleteComment(pr: number, context?: string): Promise<void>;
|
91 |
|
92 | createComment(message: string, pr: number, context?: string): Promise<Octokit.Response<Octokit.IssuesCreateCommentResponse>>;
|
93 |
|
94 | editComment(message: string, pr: number, context?: string): Promise<Octokit.Response<Octokit.IssuesCreateCommentResponse>>;
|
95 |
|
96 | addToPrBody(message: string, pr: number, context?: string): Promise<Octokit.Response<Octokit.IssuesUpdateResponse>>;
|
97 |
|
98 | publish(releaseNotes: string, tag: string, prerelease?: boolean): Promise<Octokit.Response<Octokit.ReposCreateReleaseResponse>>;
|
99 |
|
100 | getLatestTagInBranch(): Promise<string>;
|
101 | }
|
102 | export {};
|
103 |
|
\ | No newline at end of file |