1 | import { AsyncSeriesBailHook, AsyncSeriesWaterfallHook } from "tapable";
|
2 | export interface ICommitAuthor {
|
3 | /** Author's name */
|
4 | name?: string;
|
5 | /** Author's email */
|
6 | email?: string;
|
7 | /** Author's username */
|
8 | username?: string;
|
9 | /** The commit this author created */
|
10 | hash?: string;
|
11 | /** The type of user */
|
12 | type?: "Bot" | "User" | string;
|
13 | }
|
14 | export interface IPullRequest {
|
15 | /** The issue number for the pull request */
|
16 | number: number;
|
17 | /** The base branch the pull request is on */
|
18 | base?: string;
|
19 | /** The body of the PR (opening comment) */
|
20 | body?: string;
|
21 | }
|
22 | export interface ICommit {
|
23 | /**
|
24 | *
|
25 | */
|
26 | hash: string;
|
27 | /**
|
28 | *
|
29 | */
|
30 | authorName?: string;
|
31 | /**
|
32 | *
|
33 | */
|
34 | authorEmail?: string;
|
35 | /**
|
36 | *
|
37 | */
|
38 | subject: string;
|
39 | /**
|
40 | *
|
41 | */
|
42 | rawBody?: string;
|
43 | /**
|
44 | *
|
45 | */
|
46 | labels?: string[];
|
47 | /**
|
48 | *
|
49 | */
|
50 | files: string[];
|
51 | }
|
52 | export declare type IExtendedCommit = ICommit & {
|
53 | /** The authors that contributed to the pull request */
|
54 | authors: ICommitAuthor[];
|
55 | /** The pull request information */
|
56 | pullRequest?: IPullRequest;
|
57 | /** Labels associated with the commit */
|
58 | labels: string[];
|
59 | };
|
60 | /** Parse the PR information for the merge commit message */
|
61 | export declare function parsePR(commit: IExtendedCommit): IExtendedCommit;
|
62 | /** Parse the PR information for the squashed commit message */
|
63 | export declare function parseSquashPR(commit: IExtendedCommit): IExtendedCommit;
|
64 | export interface ILogParseHooks {
|
65 | /** Parse information about a commit from a commit. Here is where `auto` gets the PR number from the merge commits. */
|
66 | parseCommit: AsyncSeriesWaterfallHook<[IExtendedCommit]>;
|
67 | /** Choose to omit certain commits. If you return true the commit will be omitted. Be sure to return nothing if you don't want the commit omitted. */
|
68 | omitCommit: AsyncSeriesBailHook<[IExtendedCommit], boolean | void>;
|
69 | }
|
70 | /**
|
71 | * Parse the gitlog for commits that are PRs and attach their labels.
|
72 | * This class can also be tapped into via plugin to parse commits
|
73 | * in other ways (ex: conventional-commits)
|
74 | */
|
75 | export default class LogParse {
|
76 | /** Plugin entry points */
|
77 | hooks: ILogParseHooks;
|
78 | /** Initialize the log parser and tap the default functionality */
|
79 | constructor();
|
80 | /** Run the log parser over a set of commits */
|
81 | normalizeCommits(commits: ICommit[]): Promise<IExtendedCommit[]>;
|
82 | /** Process a commit to find it's labels and PR information */
|
83 | normalizeCommit(commit: ICommit): Promise<IExtendedCommit | undefined>;
|
84 | }
|
85 | //# sourceMappingURL=log-parse.d.ts.map |
\ | No newline at end of file |