1 | import { Octokit, RestEndpointMethodTypes } from "@octokit/rest";
|
2 | import { HttpsProxyAgent } from "https-proxy-agent";
|
3 | import { ILabelDefinition } from "./release";
|
4 | import { ILogger } from "./utils/logger";
|
5 | import { ICommit } from "./log-parse";
|
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<RestEndpointMethodTypes["repos"]["createCommitStatus"]["parameters"], "owner" | "repo">;
|
8 | export interface IGitOptions {
|
9 |
|
10 | owner: string;
|
11 |
|
12 | repo: string;
|
13 |
|
14 | baseUrl?: string;
|
15 |
|
16 | baseBranch: string;
|
17 |
|
18 | graphqlBaseUrl?: string;
|
19 |
|
20 | token?: string;
|
21 |
|
22 | agent?: HttpsProxyAgent;
|
23 | }
|
24 | export declare const automatedCommentIdentifier = "<!-- GITHUB_RELEASE";
|
25 |
|
26 |
|
27 |
|
28 |
|
29 | export default class Git {
|
30 |
|
31 | readonly github: Octokit;
|
32 |
|
33 | readonly options: IGitOptions;
|
34 |
|
35 | private readonly baseUrl;
|
36 |
|
37 | private readonly graphqlBaseUrl;
|
38 |
|
39 | private readonly logger;
|
40 |
|
41 | constructor(options: IGitOptions, logger?: ILogger);
|
42 | /** Verify the write access authorization to remote repository with push dry-run. */
|
43 | verifyAuth(url: string): Promise<boolean>;
|
44 | /** Get the "Latest Release" from GitHub */
|
45 | getLatestReleaseInfo(): Promise<import("@octokit/types").ReposGetLatestReleaseResponseData>;
|
46 | /** Get the "Latest Release" or the first commit SHA as a fallback */
|
47 | getLatestRelease(): Promise<string>;
|
48 | /** Get the date a commit sha was created */
|
49 | getCommitDate(sha: string): Promise<string>;
|
50 | /** Get the first commit for the repo */
|
51 | getFirstCommit(): Promise<string>;
|
52 | /** Get the SHA of the latest commit */
|
53 | getSha(short?: boolean): Promise<string>;
|
54 | /** Get the SHA of the latest commit */
|
55 | shaExists(sha?: string): Promise<boolean>;
|
56 | /** Get the labels for a PR */
|
57 | getLabels(prNumber: number): Promise<string[]>;
|
58 | /** Get all the information about a PR or issue */
|
59 | getPr(prNumber: number): Promise<import("@octokit/types").OctokitResponse<import("@octokit/types").IssuesGetResponseData>>;
|
60 | /** Get information about specific commit */
|
61 | getCommit(sha: string): Promise<import("@octokit/types").OctokitResponse<import("@octokit/types").ReposGetCommitResponseData>>;
|
62 | /** Get the labels for a the project */
|
63 | getProjectLabels(): Promise<string[]>;
|
64 | /** Get the git log for a range of commits */
|
65 | getGitLog(start: string, end?: string): Promise<ICommit[]>;
|
66 | /** Get the GitHub user for an email. Will not work if they do not have their email set to "public". */
|
67 | getUserByEmail(email: string): Promise<{} | undefined>;
|
68 |
|
69 | getTokenPermissionLevel(): Promise<{
|
70 | permission: string;
|
71 | user?: undefined;
|
72 | } | {
|
73 | permission: string;
|
74 | user: import("@octokit/types").UsersGetAuthenticatedResponseData;
|
75 | }>;
|
76 |
|
77 | getUserByUsername(username: string): Promise<import("@octokit/types").UsersGetByUsernameResponseData | undefined>;
|
78 |
|
79 | getPullRequest(pr: number): Promise<import("@octokit/types").OctokitResponse<import("@octokit/types").PullsGetResponseData>>;
|
80 |
|
81 | searchRepo(options: RestEndpointMethodTypes["search"]["issuesAndPullRequests"]["parameters"]): Promise<import("@octokit/types").SearchIssuesAndPullRequestsResponseData>;
|
82 |
|
83 | graphql<T>(query: string): Promise<T>;
|
84 |
|
85 | createStatus(prInfo: IPRInfo): Promise<import("@octokit/types").OctokitResponse<import("@octokit/types").ReposCreateCommitStatusResponseData>>;
|
86 |
|
87 | createLabel(label: ILabelDefinition): Promise<import("@octokit/types").OctokitResponse<import("@octokit/types").IssuesCreateLabelResponseData>>;
|
88 |
|
89 | updateLabel(label: ILabelDefinition): Promise<import("@octokit/types").OctokitResponse<import("@octokit/types").IssuesUpdateLabelResponseData>>;
|
90 |
|
91 | addLabelToPr(pr: number, label: string): Promise<import("@octokit/types").OctokitResponse<import("@octokit/types").IssuesAddLabelsResponseData>>;
|
92 |
|
93 | removeLabel(pr: number, label: string): Promise<import("@octokit/types").OctokitResponse<import("@octokit/types").IssuesRemoveLabelResponseData>>;
|
94 |
|
95 | lockIssue(issue: number): Promise<import("@octokit/types").OctokitResponse<any>>;
|
96 |
|
97 | getProject(): Promise<import("@octokit/types").ReposGetResponseData>;
|
98 |
|
99 | getPullRequests(options?: Partial<RestEndpointMethodTypes["pulls"]["list"]["parameters"]>): Promise<import("@octokit/types").PullsListResponseData>;
|
100 |
|
101 | getCommitsForPR(pr: number): Promise<import("@octokit/types").PullsListCommitsResponseData>;
|
102 |
|
103 | getCommentId(pr: number, context?: string): Promise<number>;
|
104 |
|
105 | deleteComment(pr: number, context?: string): Promise<void>;
|
106 |
|
107 | createComment(message: string, pr: number, context?: string): Promise<import("@octokit/types").OctokitResponse<import("@octokit/types").IssuesCreateCommentResponseData>>;
|
108 |
|
109 | editComment(message: string, pr: number, context?: string): Promise<import("@octokit/types").OctokitResponse<import("@octokit/types").IssuesUpdateCommentResponseData>>;
|
110 |
|
111 | addToPrBody(message: string, pr: number, context?: string): Promise<import("@octokit/types").OctokitResponse<import("@octokit/types").IssuesUpdateResponseData>>;
|
112 |
|
113 | publish(releaseNotes: string, tag: string, prerelease?: boolean): Promise<import("@octokit/types").OctokitResponse<import("@octokit/types").ReposCreateReleaseResponseData>>;
|
114 |
|
115 | getLatestTagInBranch(since?: string): Promise<string>;
|
116 |
|
117 | getPreviousTagInBranch(): Promise<string>;
|
118 |
|
119 | getTags(branch: string): Promise<string[]>;
|
120 |
|
121 | getTagNotInBaseBranch(branch: string, options?: {
|
122 |
|
123 | first?: boolean;
|
124 | }): Promise<string | undefined>;
|
125 |
|
126 | getLastTagNotInBaseBranch(branch: string): Promise<string | undefined>;
|
127 |
|
128 | matchCommitToPr(sha: string): Promise<{
|
129 | labels: string[];
|
130 | number: number;
|
131 | state: "MERGED" | "CLOSED" | "OPEN";
|
132 | body: string;
|
133 | headRefName: string;
|
134 | headRepositoryOwner: {
|
135 | login: string;
|
136 | };
|
137 | } | undefined>;
|
138 | }
|
139 | export {};
|
140 |
|
\ | No newline at end of file |