Skip to content

Commit 2971ea4

Browse files
authored
Pass PR template to TitleAndDescriptionProvider (#8025)
1 parent ac3d28c commit 2971ea4

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/api/api.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ export interface IGit {
242242
}
243243

244244
export interface TitleAndDescriptionProvider {
245-
provideTitleAndDescription(context: { commitMessages: string[], patches: string[] | { patch: string, fileUri: string, previousFileUri?: string }[], issues?: { reference: string, content: string }[] }, token: CancellationToken): Promise<{ title: string, description?: string } | undefined>;
245+
provideTitleAndDescription(context: { commitMessages: string[], patches: string[] | { patch: string, fileUri: string, previousFileUri?: string }[], issues?: { reference: string, content: string }[], template?: string }, token: CancellationToken): Promise<{ title: string, description?: string } | undefined>;
246246
}
247247

248248
export interface ReviewerComments {

src/github/createPRViewProvider.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,11 +1028,13 @@ export class CreatePullRequestViewProvider extends BaseCreatePullRequestViewProv
10281028
private async getTitleAndDescriptionFromProvider(token: vscode.CancellationToken, searchTerm?: string) {
10291029
return CreatePullRequestViewProvider.withProgress(async () => {
10301030
try {
1031+
const templatePromise = this.getPullRequestTemplate(); // Fetch in parallel
10311032
const { commitMessages, patches } = await this.getCommitsAndPatches();
10321033
const issues = await this.findIssueContext(commitMessages);
1034+
const template = await templatePromise;
10331035

10341036
const provider = this._folderRepositoryManager.getTitleAndDescriptionProvider(searchTerm);
1035-
const result = await provider?.provider.provideTitleAndDescription({ commitMessages, patches, issues }, token);
1037+
const result = await provider?.provider.provideTitleAndDescription({ commitMessages, patches, issues, template }, token);
10361038

10371039
if (provider) {
10381040
this.lastGeneratedTitleAndDescription = { ...result, providerTitle: provider.title };

0 commit comments

Comments
 (0)