1 | import { ICommit } from 'gitlog';
|
2 | import { AsyncSeriesBailHook, AsyncSeriesWaterfallHook } from 'tapable';
|
3 | export interface ICommitAuthor {
|
4 | /** Author's name */
|
5 | name?: string;
|
6 | /** Author's email */
|
7 | email?: string;
|
8 | /** Author's username */
|
9 | username?: string;
|
10 | /** The commit this author created */
|
11 | hash?: string;
|
12 | }
|
13 | export interface IPullRequest {
|
14 | /** The issue number for the pull request */
|
15 | number: number;
|
16 | /** The base branch the pull request is on */
|
17 | base?: string;
|
18 | /** The body of the PR (opening comment) */
|
19 | body?: string;
|
20 | }
|
21 | export declare type IExtendedCommit = ICommit & {
|
22 | /** The authors that contributed to the pull request */
|
23 | authors: ICommitAuthor[];
|
24 | /** The pull request information */
|
25 | pullRequest?: IPullRequest;
|
26 | /** Labels associated with the commit */
|
27 | labels: string[];
|
28 | };
|
29 | /** Parse the PR information for the merge commit message */
|
30 | export declare function parsePR(commit: IExtendedCommit): IExtendedCommit;
|
31 | /** Parse the PR information for the squashed commit message */
|
32 | export declare function parseSquashPR(commit: IExtendedCommit): IExtendedCommit;
|
33 | export interface ILogParseHooks {
|
34 | /** Parse information about a commit from a commit. Here is where `auto` gets the PR number from the merge commits. */
|
35 | parseCommit: AsyncSeriesWaterfallHook<[IExtendedCommit]>;
|
36 | /** 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. */
|
37 | omitCommit: AsyncSeriesBailHook<[IExtendedCommit], boolean | void>;
|
38 | }
|
39 | /**
|
40 | * Parse the gitlog for commits that are PRs and attach their labels.
|
41 | * This class can also be tapped into via plugin to parse commits
|
42 | * in other ways (ex: conventional-commits)
|
43 | */
|
44 | export default class LogParse {
|
45 | /** Plugin entry points */
|
46 | hooks: ILogParseHooks;
|
47 | /** Initialize the log parser and tap the default functionality */
|
48 | constructor();
|
49 | /** Run the log parser over a set of commits */
|
50 | normalizeCommits(commits: ICommit[]): Promise<IExtendedCommit[]>;
|
51 | /** Process a commit to find it's labels and PR information */
|
52 | normalizeCommit(commit: ICommit): Promise<IExtendedCommit | undefined>;
|
53 | }
|
54 | //# sourceMappingURL=log-parse.d.ts.map |
\ | No newline at end of file |