diff --git a/dist/index.js b/dist/index.js index 2b285e377..8276c98d2 100644 --- a/dist/index.js +++ b/dist/index.js @@ -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; } @@ -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; } @@ -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 */ @@ -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; @@ -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}.`, ], })); } @@ -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` + diff --git a/src/data/manager/description/base/issue_content_interface.ts b/src/data/manager/description/base/issue_content_interface.ts index 28672222c..9534ad917 100644 --- a/src/data/manager/description/base/issue_content_interface.ts +++ b/src/data/manager/description/base/issue_content_interface.ts @@ -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; } @@ -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; } diff --git a/src/data/model/execution.ts b/src/data/model/execution.ts index 57a63ab32..c250e8a0c 100644 --- a/src/data/model/execution.ts +++ b/src/data/model/execution.ts @@ -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 @@ -338,5 +338,7 @@ export class Execution { } this.currentConfiguration.branchType = this.issueType + + console.log(`Current configuration: ${JSON.stringify(this.currentConfiguration, null, 2)}`); } } \ No newline at end of file diff --git a/src/data/usecase/steps/check_changes_issue_size_use_case.ts b/src/data/usecase/steps/check_changes_issue_size_use_case.ts index 25bc891ad..149a34487 100644 --- a/src/data/usecase/steps/check_changes_issue_size_use_case.ts +++ b/src/data/usecase/steps/check_changes_issue_size_use_case.ts @@ -14,7 +14,6 @@ export class CheckChangesIssueSizeUseCase implements ParamUseCase { - 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` +