Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
b1a0256
feature-180-improve-ai-pr-descriptions: Enhance file prompt in update…
efraespada Mar 24, 2025
6abcddd
gh-action: updated compiled files
efraespada Mar 24, 2025
927c811
feature-180-improve-ai-pr-descriptions: add logging for previous and …
efraespada Mar 24, 2025
1f919a9
Merge branch 'feature/180-improve-ai-pr-descriptions' of https://gith…
efraespada Mar 24, 2025
11d385a
gh-action: updated compiled files
efraespada Mar 24, 2025
dde9fb5
feature-180-improve-ai-pr-descriptions: Refactor CheckChangesPullRequ…
efraespada Mar 24, 2025
6b154cc
Merge branch 'feature/180-improve-ai-pr-descriptions' of https://gith…
efraespada Mar 24, 2025
c994443
gh-action: updated compiled files
efraespada Mar 24, 2025
f714f3e
feature-180-improve-ai-pr-descriptions: Refactor CheckChangesPullRequ…
efraespada Mar 24, 2025
ed8b007
Merge branch 'feature/180-improve-ai-pr-descriptions' of https://gith…
efraespada Mar 24, 2025
3dad789
gh-action: updated compiled files
efraespada Mar 24, 2025
a086410
feature-180-improve-ai-pr-descriptions: Add support for push executio…
efraespada Mar 24, 2025
56f69b2
Merge branch 'feature/180-improve-ai-pr-descriptions' of https://gith…
efraespada Mar 24, 2025
2310944
gh-action: updated compiled files
efraespada Mar 24, 2025
c5cde15
feature-180-improve-ai-pr-descriptions: Enhance file prompt formattin…
efraespada Mar 24, 2025
edb0a60
Merge branch 'feature/180-improve-ai-pr-descriptions' of https://gith…
efraespada Mar 24, 2025
c813b7b
gh-action: updated compiled files
efraespada Mar 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47517,6 +47517,9 @@ class IssueContentInterface extends content_interface_1.ContentInterface {
else if (execution.isPullRequest) {
number = execution.pullRequest.number;
}
else if (execution.isPush) {
number = execution.issueNumber;
}
else {
return undefined;
}
Expand All @@ -47540,6 +47543,9 @@ class IssueContentInterface extends content_interface_1.ContentInterface {
else if (execution.isPullRequest) {
number = execution.pullRequest.number;
}
else if (execution.isPush) {
number = execution.issueNumber;
}
else {
return undefined;
}
Expand Down Expand Up @@ -48013,6 +48019,7 @@ class Execution {
this.issueNumber = (0, title_utils_1.extractIssueNumberFromPush)(this.commit.branch);
}
this.previousConfiguration = await new configuration_handler_1.ConfigurationHandler().get(this);
console.log(`Previous configuration: ${JSON.stringify(this.previousConfiguration, null, 2)}`);
/**
* Get labels of issue
*/
Expand Down Expand Up @@ -48108,6 +48115,7 @@ class Execution {
this.hotfix.active = this.pullRequest.base.indexOf(`${this.branches.hotfixTree}/`) > -1;
}
this.currentConfiguration.branchType = this.issueType;
console.log(`Current configuration: ${JSON.stringify(this.currentConfiguration, null, 2)}`);
};
this.singleAction = singleAction;
this.commitPrefixBuilder = commitPrefixBuilder;
Expand Down Expand Up @@ -51570,22 +51578,18 @@ class CheckChangesPullRequestSizeUseCase {
core.info(`Executing ${this.taskId}.`);
const result = [];
try {
if (param.currentConfiguration.parentBranch === undefined) {
core.info(`Parent branch is undefined.`);
return result;
}
const { size, reason } = await this.branchRepository.getSizeCategoryAndReason(param.owner, param.repo, param.pullRequest.head, param.pullRequest.base, param.sizeThresholds, param.labels, param.tokens.tokenPat);
if (param.labels.sizedLabel !== size) {
const labelNames = param.labels.currentIssueLabels.filter(name => name !== param.labels.sizedLabel);
labelNames.push(size);
await this.issueRepository.setLabels(param.owner, param.repo, param.issueNumber, labelNames, param.tokens.token);
console.log(`Updated labels on issue #${param.issueNumber}:`, labelNames);
await this.issueRepository.setLabels(param.owner, param.repo, param.pullRequest.number, labelNames, param.tokens.token);
console.log(`Updated labels on pull request #${param.pullRequest.number}:`, labelNames);
result.push(new result_1.Result({
id: this.taskId,
success: true,
executed: true,
steps: [
`${reason}, so the issue was resized to ${size}.`,
`${reason}, so the pull request was resized to ${size}.`,
],
}));
}
Expand Down Expand Up @@ -53725,7 +53729,7 @@ ${changesDescription}
return patch.split(/(?=@@)/).filter(section => section.trim().length > 0);
}
async processPatchSection(section, filename, status, additions, deletions, openaiApiKey, openaiModel) {
const filePrompt = `Do a summary of the changes in this file section (no titles, just a text description, avoid to use the file name or expressions like "this file" or "this section". Try to start the explanation with what was changed directly):\n\n` +
const filePrompt = `Do a summary of the changes in this file section (no titles, just a text description, avoid to use the file name or expressions like "this file" or "this section". Try to start the explanation with what was changed directly and highlight with \`\`\`language [new_line] [code here]\`\`\` any piece of code mentioned):\n\n` +
`File: ${filename}\n` +
`Status: ${status}\n` +
`Changes: +${additions} -${deletions}\n` +
Expand Down
4 changes: 4 additions & 0 deletions src/data/manager/description/base/issue_content_interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export abstract class IssueContentInterface extends ContentInterface {
number = execution.issue.number
} else if (execution.isPullRequest) {
number = execution.pullRequest.number
} else if (execution.isPush) {
number = execution.issueNumber
} else {
return undefined;
}
Expand Down Expand Up @@ -42,6 +44,8 @@ export abstract class IssueContentInterface extends ContentInterface {
number = execution.issue.number;
} else if (execution.isPullRequest) {
number = execution.pullRequest.number;
} else if (execution.isPush) {
number = execution.issueNumber;
} else {
return undefined;
}
Expand Down
4 changes: 3 additions & 1 deletion src/data/model/execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export class Execution {
}

this.previousConfiguration = await new ConfigurationHandler().get(this)

console.log(`Previous configuration: ${JSON.stringify(this.previousConfiguration, null, 2)}`);

/**
* Get labels of issue
Expand Down Expand Up @@ -338,5 +338,7 @@ export class Execution {
}

this.currentConfiguration.branchType = this.issueType

console.log(`Current configuration: ${JSON.stringify(this.currentConfiguration, null, 2)}`);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export class CheckChangesIssueSizeUseCase implements ParamUseCase<Execution, Res

const result: Result[] = []
try {

if (param.currentConfiguration.parentBranch === undefined) {
core.info(`Parent branch is undefined.`)
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ export class CheckChangesPullRequestSizeUseCase implements ParamUseCase<Executio

const result: Result[] = []
try {

if (param.currentConfiguration.parentBranch === undefined) {
core.info(`Parent branch is undefined.`)
return result;
}

const { size, reason } = await this.branchRepository.getSizeCategoryAndReason(
param.owner,
param.repo,
Expand All @@ -37,20 +31,20 @@ export class CheckChangesPullRequestSizeUseCase implements ParamUseCase<Executio
await this.issueRepository.setLabels(
param.owner,
param.repo,
param.issueNumber,
param.pullRequest.number,
labelNames,
param.tokens.token,
)

console.log(`Updated labels on issue #${param.issueNumber}:`, labelNames);
console.log(`Updated labels on pull request #${param.pullRequest.number}:`, labelNames);

result.push(
new Result({
id: this.taskId,
success: true,
executed: true,
steps: [
`${reason}, so the issue was resized to ${size}.`,
`${reason}, so the pull request was resized to ${size}.`,
],
})
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ ${changesDescription}
openaiApiKey: string,
openaiModel: string
): Promise<string> {
const filePrompt = `Do a summary of the changes in this file section (no titles, just a text description, avoid to use the file name or expressions like "this file" or "this section". Try to start the explanation with what was changed directly):\n\n` +
const filePrompt = `Do a summary of the changes in this file section (no titles, just a text description, avoid to use the file name or expressions like "this file" or "this section". Try to start the explanation with what was changed directly and highlight with \`\`\`language [new_line] [code here]\`\`\` any piece of code mentioned):\n\n` +
`File: ${filename}\n` +
`Status: ${status}\n` +
`Changes: +${additions} -${deletions}\n` +
Expand Down