Skip to content

Commit 22504bd

Browse files
authored
Add base and compare branch names to Copilot PR title and description generation (#8686)
* Add base and compare branch parameters to title and description provider * Remove baseBranch parameter from TitleAndDescriptionProvider context in multiple files
1 parent 816752d commit 22504bd

4 files changed

Lines changed: 4 additions & 5 deletions

File tree

src/api/api.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ export interface IGit {
256256
}
257257

258258
export interface TitleAndDescriptionProvider {
259-
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>;
259+
provideTitleAndDescription(context: { commitMessages: string[], patches: string[] | { patch: string, fileUri: string, previousFileUri?: string }[], issues?: { reference: string, content: string }[], template?: string, compareBranch?: string }, token: CancellationToken): Promise<{ title: string, description?: string } | undefined>;
260260
}
261261

262262
export interface ReviewerComments {

src/commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2106,7 +2106,7 @@ ${contents}
21062106

21072107
const tokenSource = new vscode.CancellationTokenSource();
21082108
const result = await provider.provider.provideTitleAndDescription(
2109-
{ commitMessages, patches, issues, template },
2109+
{ commitMessages, patches, issues, template, compareBranch: args.compareBranch },
21102110
tokenSource.token,
21112111
);
21122112

src/github/createPRViewProvider.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,8 +1232,7 @@ Don't forget to commit your template file to the repository so that it can be us
12321232
const template = await templatePromise;
12331233

12341234
const provider = this._folderRepositoryManager.getTitleAndDescriptionProvider(searchTerm);
1235-
const result = await provider?.provider.provideTitleAndDescription({ commitMessages, patches, issues, template }, token);
1236-
1235+
const result = await provider?.provider.provideTitleAndDescription({ commitMessages, patches, issues, template, compareBranch: this.model.compareBranch }, token);
12371236
if (provider) {
12381237
this.lastGeneratedTitleAndDescription = { ...result, providerTitle: provider.title };
12391238
/* __GDPR__

src/github/pullRequestOverview.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ export class PullRequestOverviewPanel extends IssueOverviewPanel<PullRequestMode
10991099
const templateContent = await this._folderRepositoryManager.getPullRequestTemplateBody(this._item.remote.owner);
11001100

11011101
const result = await provider.provider.provideTitleAndDescription(
1102-
{ commitMessages, patches, issues: [], template: templateContent },
1102+
{ commitMessages, patches, issues: [], template: templateContent, compareBranch: this._item.head?.ref },
11031103
this.generatingDescriptionCancellationToken.token
11041104
);
11051105

0 commit comments

Comments
 (0)