From 26e823fa220903fee9e9c2b4617792c3eb437f1e Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Tue, 25 Mar 2025 15:06:23 +0100 Subject: [PATCH 1/4] bugfix-195-ai-pr-description-not-ignoring-files: Enhance file ignoring logic in update_pull_request_description_use_case.ts; added support for patterns ending with /* to ignore subdirectories and improved regex handling for special characters. Added console logs for better debugging during change processing. --- .../update_pull_request_description_use_case.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/data/usecase/steps/update_pull_request_description_use_case.ts b/src/data/usecase/steps/update_pull_request_description_use_case.ts index 4b8bd5f65..3624bcfc2 100644 --- a/src/data/usecase/steps/update_pull_request_description_use_case.ts +++ b/src/data/usecase/steps/update_pull_request_description_use_case.ts @@ -138,14 +138,20 @@ ${changesDescription} return ignorePatterns.some(pattern => { // Convert glob pattern to regex const regexPattern = pattern - .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') // Escape special regex characters - .replace(/\*/g, '.*') // Convert * to regex wildcard + .replace(/[.+?^${}()|[\]\\]/g, '\\$&') // Escape special regex characters (sin afectar *) + .replace(/\*/g, '.*') // Convert * to match anything .replace(/\//g, '\\/'); // Escape forward slashes - + + // Allow pattern ending on /* to ignore also subdirectories and files inside + if (pattern.endsWith("/*")) { + return new RegExp(`^${regexPattern.replace(/\\\/\.\*$/, "(\\/.*)?")}$`).test(filename); + } + const regex = new RegExp(`^${regexPattern}$`); return regex.test(filename); }); } + private splitPatchIntoSections(patch: string): string[] { if (!patch) return []; @@ -177,11 +183,13 @@ ${changesDescription} openaiModel: string ): Promise { let changesDescription = ``; - + console.log(`Processing ${changes.length} changes`); for (const change of changes) { try { + console.log(`Processing changes for file ${change.filename}`); const shouldIgnoreFile = this.shouldIgnoreFile(change.filename, ignoreFiles); if (shouldIgnoreFile) { + console.log(`File ${change.filename} should be ignored`); continue; } From 3008b021e4cfc1f4c2449c25e725dc89abc58895 Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Tue, 25 Mar 2025 14:07:07 +0000 Subject: [PATCH 2/4] gh-action: updated compiled files --- dist/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 5202bbec2..f83c54235 100644 --- a/dist/index.js +++ b/dist/index.js @@ -53716,9 +53716,13 @@ ${changesDescription} return ignorePatterns.some(pattern => { // Convert glob pattern to regex const regexPattern = pattern - .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') // Escape special regex characters - .replace(/\*/g, '.*') // Convert * to regex wildcard + .replace(/[.+?^${}()|[\]\\]/g, '\\$&') // Escape special regex characters (sin afectar *) + .replace(/\*/g, '.*') // Convert * to match anything .replace(/\//g, '\\/'); // Escape forward slashes + // Allow pattern ending on /* to ignore also subdirectories and files inside + if (pattern.endsWith("/*")) { + return new RegExp(`^${regexPattern.replace(/\\\/\.\*$/, "(\\/.*)?")}$`).test(filename); + } const regex = new RegExp(`^${regexPattern}$`); return regex.test(filename); }); @@ -53738,10 +53742,13 @@ ${changesDescription} } async processChanges(changes, ignoreFiles, openaiApiKey, openaiModel) { let changesDescription = ``; + console.log(`Processing ${changes.length} changes`); for (const change of changes) { try { + console.log(`Processing changes for file ${change.filename}`); const shouldIgnoreFile = this.shouldIgnoreFile(change.filename, ignoreFiles); if (shouldIgnoreFile) { + console.log(`File ${change.filename} should be ignored`); continue; } const fileDescription = await this.processFile(change, openaiApiKey, openaiModel); From 37b4c8ae4db3229fd3f5bdaf901aa342bfc356ea Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Tue, 25 Mar 2025 15:43:17 +0100 Subject: [PATCH 3/4] bugfix-195-ai-pr-description-not-ignoring-files: Enhance logging and debugging capabilities across various use cases; replace console.error with centralized logError function for consistent error handling. Introduce debug flag in Execution class to control logging verbosity. --- .../description/base/content_interface.ts | 5 ++- src/data/model/execution.ts | 11 +++++- src/data/model/single_action.ts | 6 ++- src/data/repository/branch_repository.ts | 5 ++- src/data/repository/issue_repository.ts | 5 ++- .../actions/deployed_action_use_case.ts | 3 +- src/data/usecase/commit_check_use_case.ts | 3 +- src/data/usecase/publish_resume_use_case.ts | 3 +- .../usecase/pull_request_link_use_case.ts | 3 +- .../usecase/remove_issue_branches_use_case.ts | 3 +- src/data/usecase/single_action_use_case.ts | 3 +- .../steps/assign_members_to_issue_use_case.ts | 3 +- .../assign_reviewers_to_issue_use_case.ts | 3 +- .../check_changes_issue_size_use_case.ts | 3 +- ...heck_changes_pull_request_size_use_case.ts | 3 +- .../steps/check_permissions_use_case.ts | 3 +- .../usecase/steps/execute_script_use_case.ts | 3 +- .../steps/get_hotfix_version_use_case.ts | 3 +- .../steps/get_release_type_use_case.ts | 3 +- .../steps/get_release_version_use_case.ts | 3 +- .../steps/label_deploy_added_use_case.ts | 3 +- .../steps/label_deployed_added_use_case.ts | 3 +- .../steps/link_issue_project_use_case.ts | 3 +- .../steps/link_pull_request_issue_use_case.ts | 3 +- .../link_pull_request_project_use_case.ts | 3 +- .../notify_new_commit_on_issue_use_case.ts | 3 +- .../steps/prepare_branches_use_case.ts | 3 +- ...pdate_pull_request_description_use_case.ts | 5 ++- .../usecase/store_configuration_use_case.ts | 3 +- src/data/utils/logger.ts | 37 +++++++++++++++++++ src/index.ts | 6 +++ 31 files changed, 114 insertions(+), 35 deletions(-) create mode 100644 src/data/utils/logger.ts diff --git a/src/data/manager/description/base/content_interface.ts b/src/data/manager/description/base/content_interface.ts index 986bda27a..c2726b146 100644 --- a/src/data/manager/description/base/content_interface.ts +++ b/src/data/manager/description/base/content_interface.ts @@ -1,4 +1,5 @@ import * as core from "@actions/core"; +import { logError } from "../../../utils/logger"; export abstract class ContentInterface { abstract get id(): string @@ -34,7 +35,7 @@ export abstract class ContentInterface { return description.split(this.startPattern)[1].split(this.endPattern)[0] } catch (error) { - core.error(`Error reading issue configuration: ${error}`); + logError(`Error reading issue configuration: ${error}`); throw error; } } @@ -75,7 +76,7 @@ export abstract class ContentInterface { return this._updateContent(description, content); } catch (error) { - console.error(`Error updating issue description: ${error}`); + logError(`Error updating issue description: ${error}`); return undefined; } } diff --git a/src/data/model/execution.ts b/src/data/model/execution.ts index c250e8a0c..dec85245a 100644 --- a/src/data/model/execution.ts +++ b/src/data/model/execution.ts @@ -24,8 +24,11 @@ import {incrementVersion} from "../utils/version_utils"; import {SingleAction} from "./single_action"; import {Ai} from "./ai"; import { SizeThresholds } from "./size_thresholds"; +import { logDebugInfo, setGlobalLoggerDebug } from "../utils/logger"; export class Execution { + debug: boolean = false; + /** * Every usage of this field should be checked. * PRs with no issue ID in the head branch won't have it. @@ -151,6 +154,7 @@ export class Execution { } constructor( + debug: boolean, singleAction: SingleAction, commitPrefixBuilder: string, issue: Issue, @@ -167,6 +171,7 @@ export class Execution { workflows: Workflows, projects: ProjectDetail[], ) { + this.debug = debug; this.singleAction = singleAction; this.commitPrefixBuilder = commitPrefixBuilder; this.issue = issue; @@ -186,6 +191,8 @@ export class Execution { } setup = async () => { + setGlobalLoggerDebug(this.debug); + const issueRepository = new IssueRepository(); /** @@ -228,7 +235,7 @@ export class Execution { } this.previousConfiguration = await new ConfigurationHandler().get(this) - console.log(`Previous configuration: ${JSON.stringify(this.previousConfiguration, null, 2)}`); + logDebugInfo(`Previous configuration: ${JSON.stringify(this.previousConfiguration, null, 2)}`); /** * Get labels of issue @@ -339,6 +346,6 @@ export class Execution { this.currentConfiguration.branchType = this.issueType - console.log(`Current configuration: ${JSON.stringify(this.currentConfiguration, null, 2)}`); + logDebugInfo(`Current configuration: ${JSON.stringify(this.currentConfiguration, null, 2)}`); } } \ No newline at end of file diff --git a/src/data/model/single_action.ts b/src/data/model/single_action.ts index 58be3ce49..df2d17d9d 100644 --- a/src/data/model/single_action.ts +++ b/src/data/model/single_action.ts @@ -1,3 +1,5 @@ +import { logError } from "../utils/logger"; + const deployedAction = 'deployed_action' export class SingleAction { @@ -22,8 +24,8 @@ export class SingleAction { this.currentSingleActionIssue = parseInt(currentSingleActionIssue) validIssueNumber = true; } catch (error) { - console.error(error) - console.error(`Issue ${currentSingleActionIssue} is not a number.`) + logError(`Issue ${currentSingleActionIssue} is not a number.`) + logError(error) } this.currentSingleAction = currentSingleAction; this.enabledSingleAction = this.currentSingleAction.length > 0; diff --git a/src/data/repository/branch_repository.ts b/src/data/repository/branch_repository.ts index 448ba33dc..3003dab7c 100644 --- a/src/data/repository/branch_repository.ts +++ b/src/data/repository/branch_repository.ts @@ -6,6 +6,7 @@ import {Execution} from "../model/execution"; import {getLatestVersion} from "../utils/version_utils"; import { Labels } from '../model/labels'; import { SizeThresholds } from '../model/size_thresholds'; +import { logDebugInfo, logError } from '../utils/logger'; export class BranchRepository { @@ -122,7 +123,7 @@ export class BranchRepository { core.info(`Managing branches`); const branches = await this.getListOfBranches(owner, repository, token) - console.log(JSON.stringify(branches, null, 2)); + logDebugInfo(JSON.stringify(branches, null, 2)); if (hotfixBranch === undefined && isHotfix) { result.push( @@ -226,7 +227,7 @@ export class BranchRepository { ) ) } catch (error) { - console.error(error); + logError(error); result.push( new Result({ id: 'branch_repository', diff --git a/src/data/repository/issue_repository.ts b/src/data/repository/issue_repository.ts index c428216ab..d0136dc24 100644 --- a/src/data/repository/issue_repository.ts +++ b/src/data/repository/issue_repository.ts @@ -2,6 +2,7 @@ import * as github from "@actions/github"; import * as core from "@actions/core"; import {Milestone} from "../model/milestone"; import {Labels} from "../model/labels"; +import { logError } from "../utils/logger"; export class IssueRepository { @@ -224,7 +225,7 @@ export class IssueRepository { body: description, }); } catch (error) { - console.error(`Error updating issue description: ${error}`); + logError(`Error updating issue description: ${error}`); throw error; } } @@ -371,7 +372,7 @@ export class IssueRepository { return issue.title; } catch (error) { - console.error(`Failed to fetch the issue title: ${error}`); + logError(`Failed to fetch the issue title: ${error}`); return undefined; } }; diff --git a/src/data/usecase/actions/deployed_action_use_case.ts b/src/data/usecase/actions/deployed_action_use_case.ts index ed6f6101e..c39a53e8c 100644 --- a/src/data/usecase/actions/deployed_action_use_case.ts +++ b/src/data/usecase/actions/deployed_action_use_case.ts @@ -4,6 +4,7 @@ import {IssueRepository} from "../../repository/issue_repository"; import * as core from "@actions/core"; import {Result} from "../../model/result"; import {BranchRepository} from "../../repository/branch_repository"; +import { logError } from "../../utils/logger"; export class DeployedActionUseCase implements ParamUseCase { taskId: string = 'DeployedActionUseCase'; @@ -116,7 +117,7 @@ export class DeployedActionUseCase implements ParamUseCase return result; } catch (error) { - console.error(error); + logError(error); result.push( new Result({ id: this.taskId, diff --git a/src/data/usecase/commit_check_use_case.ts b/src/data/usecase/commit_check_use_case.ts index f4c5f4879..c5c4d2fa4 100644 --- a/src/data/usecase/commit_check_use_case.ts +++ b/src/data/usecase/commit_check_use_case.ts @@ -4,6 +4,7 @@ import {Result} from "../model/result"; import * as core from '@actions/core'; import { CheckChangesIssueSizeUseCase } from "./steps/check_changes_issue_size_use_case"; import { NotifyNewCommitOnIssueUseCase } from "./steps/notify_new_commit_on_issue_use_case"; +import { logError } from "../utils/logger"; export class CommitCheckUseCase implements ParamUseCase { taskId: string = 'CommitCheckUseCase'; @@ -25,7 +26,7 @@ export class CommitCheckUseCase implements ParamUseCase { results.push(...(await new NotifyNewCommitOnIssueUseCase().invoke(param))); results.push(...(await new CheckChangesIssueSizeUseCase().invoke(param))); } catch (error) { - console.error(error); + logError(error); results.push( new Result({ id: this.taskId, diff --git a/src/data/usecase/publish_resume_use_case.ts b/src/data/usecase/publish_resume_use_case.ts index 8a498817f..a3356e8e4 100644 --- a/src/data/usecase/publish_resume_use_case.ts +++ b/src/data/usecase/publish_resume_use_case.ts @@ -4,6 +4,7 @@ import {Execution} from "../model/execution"; import {Result} from "../model/result"; import {getRandomElement} from "../utils/list_utils"; import * as core from '@actions/core'; +import { logError } from "../utils/logger"; /** * Publish the resume of actions @@ -168,7 +169,7 @@ ${footer} ) } } catch (error) { - console.error(error); + logError(error); param.currentConfiguration.results.push( new Result({ id: this.taskId, diff --git a/src/data/usecase/pull_request_link_use_case.ts b/src/data/usecase/pull_request_link_use_case.ts index 0b0575767..b173e948f 100644 --- a/src/data/usecase/pull_request_link_use_case.ts +++ b/src/data/usecase/pull_request_link_use_case.ts @@ -10,6 +10,7 @@ import {AssignReviewersToIssueUseCase} from "./steps/assign_reviewers_to_issue_u import {UpdateTitleUseCase} from "./steps/update_title_use_case"; import { UpdatePullRequestDescriptionUseCase } from "./steps/update_pull_request_description_use_case"; import { CheckChangesPullRequestSizeUseCase } from "./steps/check_changes_pull_request_size_use_case"; +import { logError } from "../utils/logger"; export class PullRequestLinkUseCase implements ParamUseCase { taskId: string = 'PullRequestLinkUseCase'; @@ -82,7 +83,7 @@ export class PullRequestLinkUseCase implements ParamUseCase results.push(...await new CloseIssueAfterMergingUseCase().invoke(param)); } } catch (error) { - console.error(error); + logError(error); results.push( new Result({ id: this.taskId, diff --git a/src/data/usecase/remove_issue_branches_use_case.ts b/src/data/usecase/remove_issue_branches_use_case.ts index 8972fca07..dcc3dc55c 100644 --- a/src/data/usecase/remove_issue_branches_use_case.ts +++ b/src/data/usecase/remove_issue_branches_use_case.ts @@ -3,6 +3,7 @@ import {ParamUseCase} from "./base/param_usecase"; import {Execution} from "../model/execution"; import {Result} from "../model/result"; import * as core from '@actions/core'; +import { logError } from "../utils/logger"; /** * Remove any branch created for this issue @@ -66,7 +67,7 @@ export class RemoveIssueBranchesUseCase implements ParamUseCase { taskId: string = 'SingleActionUseCase'; @@ -21,7 +22,7 @@ export class SingleActionUseCase implements ParamUseCase { results.push(...await new DeployedActionUseCase().invoke(param)); } } catch (error) { - console.error(error); + logError(error); results.push( new Result({ id: this.taskId, diff --git a/src/data/usecase/steps/assign_members_to_issue_use_case.ts b/src/data/usecase/steps/assign_members_to_issue_use_case.ts index 56a18b447..1c8066875 100644 --- a/src/data/usecase/steps/assign_members_to_issue_use_case.ts +++ b/src/data/usecase/steps/assign_members_to_issue_use_case.ts @@ -4,6 +4,7 @@ import {IssueRepository} from "../../repository/issue_repository"; import {ProjectRepository} from "../../repository/project_repository"; import * as core from "@actions/core"; import {Result} from "../../model/result"; +import { logError } from "../../utils/logger"; export class AssignMemberToIssueUseCase implements ParamUseCase { taskId: string = 'AssignMemberToIssueUseCase'; @@ -150,7 +151,7 @@ export class AssignMemberToIssueUseCase implements ParamUseCase { taskId: string = 'AssignReviewersToIssueUseCase'; @@ -105,7 +106,7 @@ export class AssignReviewersToIssueUseCase implements ParamUseCase { taskId: string = 'CheckChangesIssueSizeUseCase'; @@ -58,7 +59,7 @@ export class CheckChangesIssueSizeUseCase implements ParamUseCase { taskId: string = 'CheckChangesPullRequestSizeUseCase'; @@ -50,7 +51,7 @@ export class CheckChangesPullRequestSizeUseCase implements ParamUseCase { taskId: string = 'CheckPermissionsUseCase'; @@ -70,7 +71,7 @@ export class CheckPermissionsUseCase implements ParamUseCase { taskId: string = 'ExecuteScriptUseCase'; @@ -45,7 +46,7 @@ export class ExecuteScriptUseCase implements ParamUseCase { }) ) } catch (error) { - console.error(error); + logError(error); result.push( new Result({ id: this.taskId, diff --git a/src/data/usecase/steps/get_hotfix_version_use_case.ts b/src/data/usecase/steps/get_hotfix_version_use_case.ts index bc388ccae..e3c197b74 100644 --- a/src/data/usecase/steps/get_hotfix_version_use_case.ts +++ b/src/data/usecase/steps/get_hotfix_version_use_case.ts @@ -6,6 +6,7 @@ import {Result} from "../../model/result"; import {MarkdownContentHotfixHandler} from "../../manager/description/markdown_content_hotfix_handler"; import {IssueRepository} from "../../repository/issue_repository"; import {extractVersion} from "../../utils/content_utils"; +import { logError } from "../../utils/logger"; export class GetHotfixVersionUseCase implements ParamUseCase { taskId: string = 'GetHotfixVersionUseCase'; @@ -92,7 +93,7 @@ export class GetHotfixVersionUseCase implements ParamUseCase { taskId: string = 'GetReleaseTypeUseCase'; @@ -80,7 +81,7 @@ export class GetReleaseTypeUseCase implements ParamUseCase }) ); } catch (error) { - console.error(error); + logError(error); result.push( new Result({ id: this.taskId, diff --git a/src/data/usecase/steps/get_release_version_use_case.ts b/src/data/usecase/steps/get_release_version_use_case.ts index f339bc2bb..310a2a201 100644 --- a/src/data/usecase/steps/get_release_version_use_case.ts +++ b/src/data/usecase/steps/get_release_version_use_case.ts @@ -4,6 +4,7 @@ import * as core from "@actions/core"; import {Result} from "../../model/result"; import {IssueRepository} from "../../repository/issue_repository"; import {extractVersion} from "../../utils/content_utils"; +import { logError } from "../../utils/logger"; export class GetReleaseVersionUseCase implements ParamUseCase { taskId: string = 'GetReleaseVersionUseCase'; @@ -77,7 +78,7 @@ export class GetReleaseVersionUseCase implements ParamUseCase { taskId: string = 'DeployAddedUseCase'; @@ -109,7 +110,7 @@ ${injectJsonAsMarkdownBlock('Workflow Parameters', parameters)}\`` ) } } catch (error) { - console.error(error); + logError(error); result.push( new Result({ id: this.taskId, diff --git a/src/data/usecase/steps/label_deployed_added_use_case.ts b/src/data/usecase/steps/label_deployed_added_use_case.ts index 2b6bd4fa9..6d4ef9be2 100644 --- a/src/data/usecase/steps/label_deployed_added_use_case.ts +++ b/src/data/usecase/steps/label_deployed_added_use_case.ts @@ -2,6 +2,7 @@ import {ParamUseCase} from "../base/param_usecase"; import {Execution} from "../../model/execution"; import {Result} from "../../model/result"; import * as core from '@actions/core'; +import { logError } from "../../utils/logger"; export class DeployedAddedUseCase implements ParamUseCase { taskId: string = 'DeployedAddedUseCase'; @@ -48,7 +49,7 @@ export class DeployedAddedUseCase implements ParamUseCase { ) } } catch (error) { - console.error(error); + logError(error); result.push( new Result({ id: this.taskId, diff --git a/src/data/usecase/steps/link_issue_project_use_case.ts b/src/data/usecase/steps/link_issue_project_use_case.ts index 93588aae9..0792d20e6 100644 --- a/src/data/usecase/steps/link_issue_project_use_case.ts +++ b/src/data/usecase/steps/link_issue_project_use_case.ts @@ -4,6 +4,7 @@ import {IssueRepository} from "../../repository/issue_repository"; import {ProjectRepository} from "../../repository/project_repository"; import * as core from "@actions/core"; import {Result} from "../../model/result"; +import { logError } from "../../utils/logger"; export class LinkIssueProjectUseCase implements ParamUseCase { taskId: string = 'LinkIssueProjectUseCase'; @@ -73,7 +74,7 @@ export class LinkIssueProjectUseCase implements ParamUseCase { taskId: string = 'LinkPullRequestIssueUseCase'; @@ -121,7 +122,7 @@ export class LinkPullRequestIssueUseCase implements ParamUseCase { taskId: string = 'LinkPullRequestProjectUseCase'; @@ -57,7 +58,7 @@ export class LinkPullRequestProjectUseCase implements ParamUseCase { taskId: string = 'NotifyNewCommitOnIssueUseCase'; @@ -132,7 +133,7 @@ ${this.separator} param.tokens.token, ) } catch (error) { - console.error(error); + logError(error); result.push( new Result({ id: this.taskId, diff --git a/src/data/usecase/steps/prepare_branches_use_case.ts b/src/data/usecase/steps/prepare_branches_use_case.ts index 426bc55a9..bcc1adf84 100644 --- a/src/data/usecase/steps/prepare_branches_use_case.ts +++ b/src/data/usecase/steps/prepare_branches_use_case.ts @@ -5,6 +5,7 @@ import {BranchRepository} from "../../repository/branch_repository"; import {Result} from "../../model/result"; import {ExecuteScriptUseCase} from "./execute_script_use_case"; import {IssueRepository} from "../../repository/issue_repository"; +import { logError } from "../../utils/logger"; export class PrepareBranchesUseCase implements ParamUseCase { taskId: string = 'PrepareBranchesUseCase'; @@ -312,7 +313,7 @@ export class PrepareBranchesUseCase implements ParamUseCase return result; } catch (error) { - console.error(error); + logError(error); result.push( new Result({ id: this.taskId, diff --git a/src/data/usecase/steps/update_pull_request_description_use_case.ts b/src/data/usecase/steps/update_pull_request_description_use_case.ts index 3624bcfc2..b82f32c07 100644 --- a/src/data/usecase/steps/update_pull_request_description_use_case.ts +++ b/src/data/usecase/steps/update_pull_request_description_use_case.ts @@ -6,6 +6,7 @@ import { AiRepository } from "../../repository/ai_repository"; import { PullRequestRepository } from "../../repository/pull_request_repository"; import { ProjectRepository } from "../../repository/project_repository"; import { IssueRepository } from "../../repository/issue_repository"; +import { logError } from "../../utils/logger"; export class UpdatePullRequestDescriptionUseCase implements ParamUseCase { taskId: string = 'UpdatePullRequestDescriptionUseCase'; private aiRepository = new AiRepository(); @@ -116,7 +117,7 @@ ${changesDescription} ); } catch (error) { - console.error(error); + logError(error); result.push( new Result( { @@ -196,7 +197,7 @@ ${changesDescription} const fileDescription = await this.processFile(change, openaiApiKey, openaiModel); changesDescription += `- \`${change.filename}\`:\n ${fileDescription}\n\n`; } catch (error) { - console.error(error); + logError(error); throw new Error(`Error processing file ${change.filename}: ${error}`); } } diff --git a/src/data/usecase/store_configuration_use_case.ts b/src/data/usecase/store_configuration_use_case.ts index 9c867ea85..463b0bcff 100644 --- a/src/data/usecase/store_configuration_use_case.ts +++ b/src/data/usecase/store_configuration_use_case.ts @@ -2,6 +2,7 @@ import {ParamUseCase} from "./base/param_usecase"; import {Execution} from "../model/execution"; import * as core from '@actions/core'; import {ConfigurationHandler} from "../manager/description/configuration_handler"; +import { logError } from "../utils/logger"; /** * Store las configuration in the description @@ -17,7 +18,7 @@ export class StoreConfigurationUseCase implements ParamUseCase param ) } catch (error) { - console.error(error); + logError(error); } } } diff --git a/src/data/utils/logger.ts b/src/data/utils/logger.ts new file mode 100644 index 000000000..864fae431 --- /dev/null +++ b/src/data/utils/logger.ts @@ -0,0 +1,37 @@ +import * as core from "@actions/core"; + +let loggerDebug = false; + +export function setGlobalLoggerDebug(debug: boolean) { + loggerDebug = debug; +} + +export function logInfo(message: string) { + core.info(message); +} + +export function logWarning(message: string) { + core.warning(message); +} + +export function logError(message: any) { + core.error(message.toString()); +} + +export function logDebugInfo(message: string) { + if (loggerDebug) { + core.info(message); + } +} + +export function logDebugWarning(message: string) { + if (loggerDebug) { + core.warning(message); + } +} + +export function logDebugError(message: any) { + if (loggerDebug) { + core.error(message.toString()); + } +} diff --git a/src/index.ts b/src/index.ts index 0b11560ad..7de12b9e3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -203,6 +203,11 @@ const DEFAULT_IMAGE_CONFIG = { async function run(): Promise { const projectRepository = new ProjectRepository(); + /** + * Debug + */ + const debug = core.getInput('debug') == 'true' + /** * Single action */ @@ -555,6 +560,7 @@ async function run(): Promise { const pullRequestMergeTimeout = parseInt(core.getInput('merge-timeout')) ?? 0; const execution = new Execution( + debug, new SingleAction( singleAction, singleActionIssue, From 6b09792b41f43664f3516386565c8d7d581f2c3b Mon Sep 17 00:00:00 2001 From: Efra Espada Date: Tue, 25 Mar 2025 14:44:13 +0000 Subject: [PATCH 4/4] gh-action: updated compiled files --- dist/index.js | 191 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 153 insertions(+), 38 deletions(-) diff --git a/dist/index.js b/dist/index.js index f83c54235..99e5f4931 100644 --- a/dist/index.js +++ b/dist/index.js @@ -47384,6 +47384,7 @@ var __importStar = (this && this.__importStar) || (function () { Object.defineProperty(exports, "__esModule", ({ value: true })); exports.ContentInterface = void 0; const core = __importStar(__nccwpck_require__(2186)); +const logger_1 = __nccwpck_require__(1517); class ContentInterface { constructor() { this.getContent = (description) => { @@ -47397,7 +47398,7 @@ class ContentInterface { return description.split(this.startPattern)[1].split(this.endPattern)[0]; } catch (error) { - core.error(`Error reading issue configuration: ${error}`); + (0, logger_1.logError)(`Error reading issue configuration: ${error}`); throw error; } }; @@ -47432,7 +47433,7 @@ class ContentInterface { return this._updateContent(description, content); } catch (error) { - console.error(`Error updating issue description: ${error}`); + (0, logger_1.logError)(`Error updating issue description: ${error}`); return undefined; } }; @@ -47925,6 +47926,7 @@ const get_release_version_use_case_1 = __nccwpck_require__(9816); const get_release_type_use_case_1 = __nccwpck_require__(6790); const branch_repository_1 = __nccwpck_require__(7701); const version_utils_1 = __nccwpck_require__(8202); +const logger_1 = __nccwpck_require__(1517); class Execution { get eventName() { return github.context.eventName; @@ -47981,7 +47983,8 @@ class Execution { get commit() { return new commit_1.Commit(); } - constructor(singleAction, commitPrefixBuilder, issue, pullRequest, emoji, giphy, tokens, ai, labels, sizeThresholds, branches, release, hotfix, workflows, projects) { + constructor(debug, singleAction, commitPrefixBuilder, issue, pullRequest, emoji, giphy, tokens, ai, labels, sizeThresholds, branches, release, hotfix, workflows, projects) { + this.debug = false; /** * Every usage of this field should be checked. * PRs with no issue ID in the head branch won't have it. @@ -47991,6 +47994,7 @@ class Execution { this.issueNumber = -1; this.commitPrefixBuilderParams = {}; this.setup = async () => { + (0, logger_1.setGlobalLoggerDebug)(this.debug); const issueRepository = new issue_repository_1.IssueRepository(); /** * Set the issue number @@ -48019,7 +48023,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)}`); + (0, logger_1.logDebugInfo)(`Previous configuration: ${JSON.stringify(this.previousConfiguration, null, 2)}`); /** * Get labels of issue */ @@ -48115,8 +48119,9 @@ 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)}`); + (0, logger_1.logDebugInfo)(`Current configuration: ${JSON.stringify(this.currentConfiguration, null, 2)}`); }; + this.debug = debug; this.singleAction = singleAction; this.commitPrefixBuilder = commitPrefixBuilder; this.issue = issue; @@ -48579,12 +48584,13 @@ exports.Result = Result; /***/ }), /***/ 8024: -/***/ ((__unused_webpack_module, exports) => { +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); exports.SingleAction = void 0; +const logger_1 = __nccwpck_require__(1517); const deployedAction = 'deployed_action'; class SingleAction { get isDeployedAction() { @@ -48601,8 +48607,8 @@ class SingleAction { validIssueNumber = true; } catch (error) { - console.error(error); - console.error(`Issue ${currentSingleActionIssue} is not a number.`); + (0, logger_1.logError)(`Issue ${currentSingleActionIssue} is not a number.`); + (0, logger_1.logError)(error); } this.currentSingleAction = currentSingleAction; this.enabledSingleAction = this.currentSingleAction.length > 0; @@ -48815,6 +48821,7 @@ const core = __importStar(__nccwpck_require__(2186)); const github = __importStar(__nccwpck_require__(5438)); const result_1 = __nccwpck_require__(7305); const version_utils_1 = __nccwpck_require__(8202); +const logger_1 = __nccwpck_require__(1517); class BranchRepository { constructor() { this.fetchRemoteBranches = async () => { @@ -48913,7 +48920,7 @@ class BranchRepository { try { core.info(`Managing branches`); const branches = await this.getListOfBranches(owner, repository, token); - console.log(JSON.stringify(branches, null, 2)); + (0, logger_1.logDebugInfo)(JSON.stringify(branches, null, 2)); if (hotfixBranch === undefined && isHotfix) { result.push(new result_1.Result({ id: 'branch_repository', @@ -48990,7 +48997,7 @@ class BranchRepository { result.push(...await this.createLinkedBranch(owner, repository, baseBranchName, newBranchName, issueNumber, undefined, token)); } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: 'branch_repository', success: false, @@ -49479,6 +49486,7 @@ exports.IssueRepository = void 0; const github = __importStar(__nccwpck_require__(5438)); const core = __importStar(__nccwpck_require__(2186)); const milestone_1 = __nccwpck_require__(2298); +const logger_1 = __nccwpck_require__(1517); class IssueRepository { constructor() { this.updateTitleIssueFormat = async (owner, repository, version, issueTitle, issueNumber, branchManagementAlways, branchManagementEmoji, labels, token) => { @@ -49673,7 +49681,7 @@ class IssueRepository { }); } catch (error) { - console.error(`Error updating issue description: ${error}`); + (0, logger_1.logError)(`Error updating issue description: ${error}`); throw error; } }; @@ -49780,7 +49788,7 @@ class IssueRepository { return issue.title; } catch (error) { - console.error(`Failed to fetch the issue title: ${error}`); + (0, logger_1.logError)(`Failed to fetch the issue title: ${error}`); return undefined; } }; @@ -50343,6 +50351,7 @@ const issue_repository_1 = __nccwpck_require__(57); const core = __importStar(__nccwpck_require__(2186)); const result_1 = __nccwpck_require__(7305); const branch_repository_1 = __nccwpck_require__(7701); +const logger_1 = __nccwpck_require__(1517); class DeployedActionUseCase { constructor() { this.taskId = 'DeployedActionUseCase'; @@ -50402,7 +50411,7 @@ class DeployedActionUseCase { return result; } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -50463,6 +50472,7 @@ const result_1 = __nccwpck_require__(7305); const core = __importStar(__nccwpck_require__(2186)); const check_changes_issue_size_use_case_1 = __nccwpck_require__(6555); const notify_new_commit_on_issue_use_case_1 = __nccwpck_require__(7687); +const logger_1 = __nccwpck_require__(1517); class CommitCheckUseCase { constructor() { this.taskId = 'CommitCheckUseCase'; @@ -50482,7 +50492,7 @@ class CommitCheckUseCase { results.push(...(await new check_changes_issue_size_use_case_1.CheckChangesIssueSizeUseCase().invoke(param))); } catch (error) { - console.error(error); + (0, logger_1.logError)(error); results.push(new result_1.Result({ id: this.taskId, success: false, @@ -50654,6 +50664,7 @@ const issue_repository_1 = __nccwpck_require__(57); const result_1 = __nccwpck_require__(7305); const list_utils_1 = __nccwpck_require__(834); const core = __importStar(__nccwpck_require__(2186)); +const logger_1 = __nccwpck_require__(1517); /** * Publish the resume of actions */ @@ -50807,7 +50818,7 @@ ${footer} } } catch (error) { - console.error(error); + (0, logger_1.logError)(error); param.currentConfiguration.results.push(new result_1.Result({ id: this.taskId, success: false, @@ -50875,6 +50886,7 @@ const assign_reviewers_to_issue_use_case_1 = __nccwpck_require__(3208); const update_title_use_case_1 = __nccwpck_require__(8411); const update_pull_request_description_use_case_1 = __nccwpck_require__(1977); const check_changes_pull_request_size_use_case_1 = __nccwpck_require__(6875); +const logger_1 = __nccwpck_require__(1517); class PullRequestLinkUseCase { constructor() { this.taskId = 'PullRequestLinkUseCase'; @@ -50942,7 +50954,7 @@ class PullRequestLinkUseCase { } } catch (error) { - console.error(error); + (0, logger_1.logError)(error); results.push(new result_1.Result({ id: this.taskId, success: false, @@ -51004,6 +51016,7 @@ exports.RemoveIssueBranchesUseCase = void 0; const branch_repository_1 = __nccwpck_require__(7701); const result_1 = __nccwpck_require__(7305); const core = __importStar(__nccwpck_require__(2186)); +const logger_1 = __nccwpck_require__(1517); /** * Remove any branch created for this issue */ @@ -51051,7 +51064,7 @@ class RemoveIssueBranchesUseCase { } } catch (error) { - console.error(error); + (0, logger_1.logError)(error); results.push(new result_1.Result({ id: this.taskId, success: false, @@ -51113,6 +51126,7 @@ exports.SingleActionUseCase = void 0; const result_1 = __nccwpck_require__(7305); const core = __importStar(__nccwpck_require__(2186)); const deployed_action_use_case_1 = __nccwpck_require__(9814); +const logger_1 = __nccwpck_require__(1517); class SingleActionUseCase { constructor() { this.taskId = 'SingleActionUseCase'; @@ -51130,7 +51144,7 @@ class SingleActionUseCase { } } catch (error) { - console.error(error); + (0, logger_1.logError)(error); results.push(new result_1.Result({ id: this.taskId, success: false, @@ -51193,6 +51207,7 @@ const issue_repository_1 = __nccwpck_require__(57); const project_repository_1 = __nccwpck_require__(7917); const core = __importStar(__nccwpck_require__(2186)); const result_1 = __nccwpck_require__(7305); +const logger_1 = __nccwpck_require__(1517); class AssignMemberToIssueUseCase { constructor() { this.taskId = 'AssignMemberToIssueUseCase'; @@ -51285,7 +51300,7 @@ class AssignMemberToIssueUseCase { return result; } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -51347,6 +51362,7 @@ const project_repository_1 = __nccwpck_require__(7917); const core = __importStar(__nccwpck_require__(2186)); const result_1 = __nccwpck_require__(7305); const pull_request_repository_1 = __nccwpck_require__(634); +const logger_1 = __nccwpck_require__(1517); class AssignReviewersToIssueUseCase { constructor() { this.taskId = 'AssignReviewersToIssueUseCase'; @@ -51407,7 +51423,7 @@ class AssignReviewersToIssueUseCase { return result; } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -51470,6 +51486,7 @@ const result_1 = __nccwpck_require__(7305); const core = __importStar(__nccwpck_require__(2186)); const branch_repository_1 = __nccwpck_require__(7701); const issue_repository_1 = __nccwpck_require__(57); +const logger_1 = __nccwpck_require__(1517); class CheckChangesIssueSizeUseCase { constructor() { this.taskId = 'CheckChangesIssueSizeUseCase'; @@ -51503,7 +51520,7 @@ class CheckChangesIssueSizeUseCase { } } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -51568,6 +51585,7 @@ const result_1 = __nccwpck_require__(7305); const core = __importStar(__nccwpck_require__(2186)); const branch_repository_1 = __nccwpck_require__(7701); const issue_repository_1 = __nccwpck_require__(57); +const logger_1 = __nccwpck_require__(1517); class CheckChangesPullRequestSizeUseCase { constructor() { this.taskId = 'CheckChangesPullRequestSizeUseCase'; @@ -51595,7 +51613,7 @@ class CheckChangesPullRequestSizeUseCase { } } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -51659,6 +51677,7 @@ exports.CheckPermissionsUseCase = void 0; const project_repository_1 = __nccwpck_require__(7917); const core = __importStar(__nccwpck_require__(2186)); const result_1 = __nccwpck_require__(7305); +const logger_1 = __nccwpck_require__(1517); class CheckPermissionsUseCase { constructor() { this.taskId = 'CheckPermissionsUseCase'; @@ -51712,7 +51731,7 @@ class CheckPermissionsUseCase { } } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -51957,6 +51976,7 @@ exports.ExecuteScriptUseCase = void 0; const core = __importStar(__nccwpck_require__(2186)); const result_1 = __nccwpck_require__(7305); const isolated_vm_1 = __importDefault(__nccwpck_require__(4290)); +const logger_1 = __nccwpck_require__(1517); class ExecuteScriptUseCase { constructor() { this.taskId = 'ExecuteScriptUseCase'; @@ -51991,7 +52011,7 @@ class ExecuteScriptUseCase { })); } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -52052,6 +52072,7 @@ const core = __importStar(__nccwpck_require__(2186)); const result_1 = __nccwpck_require__(7305); const issue_repository_1 = __nccwpck_require__(57); const content_utils_1 = __nccwpck_require__(4799); +const logger_1 = __nccwpck_require__(1517); class GetHotfixVersionUseCase { constructor() { this.taskId = 'GetHotfixVersionUseCase'; @@ -52121,7 +52142,7 @@ class GetHotfixVersionUseCase { })); } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -52182,6 +52203,7 @@ const core = __importStar(__nccwpck_require__(2186)); const result_1 = __nccwpck_require__(7305); const issue_repository_1 = __nccwpck_require__(57); const content_utils_1 = __nccwpck_require__(4799); +const logger_1 = __nccwpck_require__(1517); class GetReleaseTypeUseCase { constructor() { this.taskId = 'GetReleaseTypeUseCase'; @@ -52240,7 +52262,7 @@ class GetReleaseTypeUseCase { })); } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -52301,6 +52323,7 @@ const core = __importStar(__nccwpck_require__(2186)); const result_1 = __nccwpck_require__(7305); const issue_repository_1 = __nccwpck_require__(57); const content_utils_1 = __nccwpck_require__(4799); +const logger_1 = __nccwpck_require__(1517); class GetReleaseVersionUseCase { constructor() { this.taskId = 'GetReleaseVersionUseCase'; @@ -52358,7 +52381,7 @@ class GetReleaseVersionUseCase { })); } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -52419,6 +52442,7 @@ const result_1 = __nccwpck_require__(7305); const core = __importStar(__nccwpck_require__(2186)); const branch_repository_1 = __nccwpck_require__(7701); const content_utils_1 = __nccwpck_require__(4799); +const logger_1 = __nccwpck_require__(1517); class DeployAddedUseCase { constructor() { this.taskId = 'DeployAddedUseCase'; @@ -52502,7 +52526,7 @@ ${(0, content_utils_1.injectJsonAsMarkdownBlock)('Workflow Parameters', paramete } } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -52565,6 +52589,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.DeployedAddedUseCase = void 0; const result_1 = __nccwpck_require__(7305); const core = __importStar(__nccwpck_require__(2186)); +const logger_1 = __nccwpck_require__(1517); class DeployedAddedUseCase { constructor() { this.taskId = 'DeployedAddedUseCase'; @@ -52607,7 +52632,7 @@ class DeployedAddedUseCase { } } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -52672,6 +52697,7 @@ const issue_repository_1 = __nccwpck_require__(57); const project_repository_1 = __nccwpck_require__(7917); const core = __importStar(__nccwpck_require__(2186)); const result_1 = __nccwpck_require__(7305); +const logger_1 = __nccwpck_require__(1517); class LinkIssueProjectUseCase { constructor() { this.taskId = 'LinkIssueProjectUseCase'; @@ -52716,7 +52742,7 @@ class LinkIssueProjectUseCase { return result; } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -52779,6 +52805,7 @@ const result_1 = __nccwpck_require__(7305); const github = __importStar(__nccwpck_require__(5438)); const pull_request_repository_1 = __nccwpck_require__(634); const core = __importStar(__nccwpck_require__(2186)); +const logger_1 = __nccwpck_require__(1517); class LinkPullRequestIssueUseCase { constructor() { this.taskId = 'LinkPullRequestIssueUseCase'; @@ -52850,7 +52877,7 @@ class LinkPullRequestIssueUseCase { } } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -52913,6 +52940,7 @@ const project_repository_1 = __nccwpck_require__(7917); const core_1 = __nccwpck_require__(2186); const result_1 = __nccwpck_require__(7305); const core = __importStar(__nccwpck_require__(2186)); +const logger_1 = __nccwpck_require__(1517); class LinkPullRequestProjectUseCase { constructor() { this.taskId = 'LinkPullRequestProjectUseCase'; @@ -52951,7 +52979,7 @@ class LinkPullRequestProjectUseCase { return result; } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -53015,6 +53043,7 @@ const core = __importStar(__nccwpck_require__(2186)); const issue_repository_1 = __nccwpck_require__(57); const list_utils_1 = __nccwpck_require__(834); const execute_script_use_case_1 = __nccwpck_require__(8057); +const logger_1 = __nccwpck_require__(1517); class NotifyNewCommitOnIssueUseCase { constructor() { this.taskId = 'NotifyNewCommitOnIssueUseCase'; @@ -53119,7 +53148,7 @@ ${this.separator} await this.issueRepository.addComment(param.owner, param.repo, param.issueNumber, commentBody, param.tokens.token); } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -53185,6 +53214,7 @@ const branch_repository_1 = __nccwpck_require__(7701); const result_1 = __nccwpck_require__(7305); const execute_script_use_case_1 = __nccwpck_require__(8057); const issue_repository_1 = __nccwpck_require__(57); +const logger_1 = __nccwpck_require__(1517); class PrepareBranchesUseCase { constructor() { this.taskId = 'PrepareBranchesUseCase'; @@ -53417,7 +53447,7 @@ class PrepareBranchesUseCase { return result; } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -53632,6 +53662,7 @@ const ai_repository_1 = __nccwpck_require__(8307); const pull_request_repository_1 = __nccwpck_require__(634); const project_repository_1 = __nccwpck_require__(7917); const issue_repository_1 = __nccwpck_require__(57); +const logger_1 = __nccwpck_require__(1517); class UpdatePullRequestDescriptionUseCase { constructor() { this.taskId = 'UpdatePullRequestDescriptionUseCase'; @@ -53700,7 +53731,7 @@ ${changesDescription} })); } catch (error) { - console.error(error); + (0, logger_1.logError)(error); result.push(new result_1.Result({ id: this.taskId, success: false, @@ -53755,7 +53786,7 @@ ${changesDescription} changesDescription += `- \`${change.filename}\`:\n ${fileDescription}\n\n`; } catch (error) { - console.error(error); + (0, logger_1.logError)(error); throw new Error(`Error processing file ${change.filename}: ${error}`); } } @@ -53972,6 +54003,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); exports.StoreConfigurationUseCase = void 0; const core = __importStar(__nccwpck_require__(2186)); const configuration_handler_1 = __nccwpck_require__(3264); +const logger_1 = __nccwpck_require__(1517); /** * Store las configuration in the description */ @@ -53986,7 +54018,7 @@ class StoreConfigurationUseCase { await this.handler.update(param); } catch (error) { - console.error(error); + (0, logger_1.logError)(error); } } } @@ -54097,6 +54129,85 @@ const getRandomElement = (list) => { exports.getRandomElement = getRandomElement; +/***/ }), + +/***/ 1517: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || (function () { + var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); + }; + return function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.setGlobalLoggerDebug = setGlobalLoggerDebug; +exports.logInfo = logInfo; +exports.logWarning = logWarning; +exports.logError = logError; +exports.logDebugInfo = logDebugInfo; +exports.logDebugWarning = logDebugWarning; +exports.logDebugError = logDebugError; +const core = __importStar(__nccwpck_require__(2186)); +let loggerDebug = false; +function setGlobalLoggerDebug(debug) { + loggerDebug = debug; +} +function logInfo(message) { + core.info(message); +} +function logWarning(message) { + core.warning(message); +} +function logError(message) { + core.error(message.toString()); +} +function logDebugInfo(message) { + if (loggerDebug) { + core.info(message); + } +} +function logDebugWarning(message) { + if (loggerDebug) { + core.warning(message); + } +} +function logDebugError(message) { + if (loggerDebug) { + core.error(message.toString()); + } +} + + /***/ }), /***/ 6212: @@ -54499,6 +54610,10 @@ const DEFAULT_IMAGE_CONFIG = { }; async function run() { const projectRepository = new project_repository_1.ProjectRepository(); + /** + * Debug + */ + const debug = core.getInput('debug') == 'true'; /** * Single action */ @@ -54794,7 +54909,7 @@ async function run() { const pullRequestDesiredAssigneesCount = parseInt(core.getInput('desired-assignees-count')) ?? 0; const pullRequestDesiredReviewersCount = parseInt(core.getInput('desired-reviewers-count')) ?? 0; const pullRequestMergeTimeout = parseInt(core.getInput('merge-timeout')) ?? 0; - const execution = new execution_1.Execution(new single_action_1.SingleAction(singleAction, singleActionIssue), commitPrefixBuilder, new issue_1.Issue(branchManagementAlways, reopenIssueOnPush, issueDesiredAssigneesCount), new pull_request_1.PullRequest(pullRequestDesiredAssigneesCount, pullRequestDesiredReviewersCount, pullRequestMergeTimeout), new emoji_1.Emoji(titleEmoji, branchManagementEmoji), new images_1.Images(imagesOnIssue, imagesOnPullRequest, imagesOnCommit, imagesIssueAutomatic, imagesIssueFeature, imagesIssueBugfix, imagesIssueDocs, imagesIssueChore, imagesIssueRelease, imagesIssueHotfix, imagesPullRequestAutomatic, imagesPullRequestFeature, imagesPullRequestBugfix, imagesPullRequestRelease, imagesPullRequestHotfix, imagesPullRequestDocs, imagesPullRequestChore, imagesCommitAutomatic, imagesCommitFeature, imagesCommitBugfix, imagesCommitRelease, imagesCommitHotfix, imagesCommitDocs, imagesCommitChore), new tokens_1.Tokens(token, tokenPat), new ai_1.Ai(openaiApiKey, openaiModel, aiPullRequestDescription, aiMembersOnly, aiIgnoreFiles), new labels_1.Labels(branchManagementLauncherLabel, bugLabel, bugfixLabel, hotfixLabel, enhancementLabel, featureLabel, releaseLabel, questionLabel, helpLabel, deployLabel, deployedLabel, docsLabel, documentationLabel, choreLabel, maintenanceLabel, sizeXxlLabel, sizeXlLabel, sizeLLabel, sizeMLabel, sizeSLabel, sizeXsLabel), new size_thresholds_1.SizeThresholds(new size_threshold_1.SizeThreshold(sizeXxlThresholdLines, sizeXxlThresholdFiles, sizeXxlThresholdCommits), new size_threshold_1.SizeThreshold(sizeXlThresholdLines, sizeXlThresholdFiles, sizeXlThresholdCommits), new size_threshold_1.SizeThreshold(sizeLThresholdLines, sizeLThresholdFiles, sizeLThresholdCommits), new size_threshold_1.SizeThreshold(sizeMThresholdLines, sizeMThresholdFiles, sizeMThresholdCommits), new size_threshold_1.SizeThreshold(sizeSThresholdLines, sizeSThresholdFiles, sizeSThresholdCommits), new size_threshold_1.SizeThreshold(sizeXsThresholdLines, sizeXsThresholdFiles, sizeXsThresholdCommits)), new branches_1.Branches(mainBranch, developmentBranch, featureTree, bugfixTree, hotfixTree, releaseTree, docsTree, choreTree), new release_1.Release(), new hotfix_1.Hotfix(), new workflows_1.Workflows(releaseWorkflow, hotfixWorkflow), projects); + const execution = new execution_1.Execution(debug, new single_action_1.SingleAction(singleAction, singleActionIssue), commitPrefixBuilder, new issue_1.Issue(branchManagementAlways, reopenIssueOnPush, issueDesiredAssigneesCount), new pull_request_1.PullRequest(pullRequestDesiredAssigneesCount, pullRequestDesiredReviewersCount, pullRequestMergeTimeout), new emoji_1.Emoji(titleEmoji, branchManagementEmoji), new images_1.Images(imagesOnIssue, imagesOnPullRequest, imagesOnCommit, imagesIssueAutomatic, imagesIssueFeature, imagesIssueBugfix, imagesIssueDocs, imagesIssueChore, imagesIssueRelease, imagesIssueHotfix, imagesPullRequestAutomatic, imagesPullRequestFeature, imagesPullRequestBugfix, imagesPullRequestRelease, imagesPullRequestHotfix, imagesPullRequestDocs, imagesPullRequestChore, imagesCommitAutomatic, imagesCommitFeature, imagesCommitBugfix, imagesCommitRelease, imagesCommitHotfix, imagesCommitDocs, imagesCommitChore), new tokens_1.Tokens(token, tokenPat), new ai_1.Ai(openaiApiKey, openaiModel, aiPullRequestDescription, aiMembersOnly, aiIgnoreFiles), new labels_1.Labels(branchManagementLauncherLabel, bugLabel, bugfixLabel, hotfixLabel, enhancementLabel, featureLabel, releaseLabel, questionLabel, helpLabel, deployLabel, deployedLabel, docsLabel, documentationLabel, choreLabel, maintenanceLabel, sizeXxlLabel, sizeXlLabel, sizeLLabel, sizeMLabel, sizeSLabel, sizeXsLabel), new size_thresholds_1.SizeThresholds(new size_threshold_1.SizeThreshold(sizeXxlThresholdLines, sizeXxlThresholdFiles, sizeXxlThresholdCommits), new size_threshold_1.SizeThreshold(sizeXlThresholdLines, sizeXlThresholdFiles, sizeXlThresholdCommits), new size_threshold_1.SizeThreshold(sizeLThresholdLines, sizeLThresholdFiles, sizeLThresholdCommits), new size_threshold_1.SizeThreshold(sizeMThresholdLines, sizeMThresholdFiles, sizeMThresholdCommits), new size_threshold_1.SizeThreshold(sizeSThresholdLines, sizeSThresholdFiles, sizeSThresholdCommits), new size_threshold_1.SizeThreshold(sizeXsThresholdLines, sizeXsThresholdFiles, sizeXsThresholdCommits)), new branches_1.Branches(mainBranch, developmentBranch, featureTree, bugfixTree, hotfixTree, releaseTree, docsTree, choreTree), new release_1.Release(), new hotfix_1.Hotfix(), new workflows_1.Workflows(releaseWorkflow, hotfixWorkflow), projects); await execution.setup(); if (execution.issueNumber === -1) { core.info(`Issue number not found. Skipping.`);