diff --git a/dist/cli/index.js b/dist/cli/index.js index a8c74d3..4873d1c 100755 --- a/dist/cli/index.js +++ b/dist/cli/index.js @@ -256,11 +256,11 @@ class ConfigsParser { // apply validation, throw errors if something is wrong // if pr is opened check if the there exists one single commit if (configs.originalPullRequest.state == "open") { - this.logger.warn("Trying to backport an open pull request!"); + this.logger.warn("Trying to backport an open pull request"); } - // if PR is closed and not merged log a warning + // if PR is closed and not merged throw an error if (configs.originalPullRequest.state == "closed" && !configs.originalPullRequest.merged) { - throw new Error("Provided pull request is closed and not merged!"); + throw new Error("Provided pull request is closed and not merged"); } return Promise.resolve(configs); } @@ -412,7 +412,7 @@ class GitCLIService { * @param branch branch which should be cloned */ async clone(from, to, branch) { - this.logger.info(`Cloning repository ${from} to ${to}.`); + this.logger.info(`Cloning repository ${from} to ${to}`); if (!fs_1.default.existsSync(to)) { await (0, simple_git_1.default)().clone(this.remoteWithAuth(from), to, ["--quiet", "--shallow-submodules", "--no-tags", "--branch", branch]); } @@ -426,7 +426,7 @@ class GitCLIService { * @param newBranch new branch name */ async createLocalBranch(cwd, newBranch) { - this.logger.info(`Creating branch ${newBranch}.`); + this.logger.info(`Creating branch ${newBranch}`); await this.git(cwd).checkoutLocalBranch(newBranch); } /** @@ -436,7 +436,7 @@ class GitCLIService { * @param remoteName [optional] name of the remote, by default 'fork' is used */ async addRemote(cwd, remote, remoteName = "fork") { - this.logger.info(`Adding new remote ${remote}.`); + this.logger.info(`Adding new remote ${remote}`); await this.git(cwd).addRemote(remoteName, this.remoteWithAuth(remote)); } /** @@ -446,7 +446,7 @@ class GitCLIService { * @param remote [optional] the remote to fetch, by default origin */ async fetch(cwd, branch, remote = "origin") { - this.logger.info(`Fetching ${remote} ${branch}.`); + this.logger.info(`Fetching ${remote} ${branch}`); await this.git(cwd).fetch(remote, branch, ["--quiet"]); } /** @@ -455,7 +455,7 @@ class GitCLIService { * @param sha commit sha */ async cherryPick(cwd, sha, strategy = "recursive", strategyOption = "theirs") { - this.logger.info(`Cherry picking ${sha}.`); + this.logger.info(`Cherry picking ${sha}`); const options = ["cherry-pick", "-m", "1", `--strategy=${strategy}`, `--strategy-option=${strategyOption}`, sha]; try { await this.git(cwd).raw(options); @@ -475,7 +475,7 @@ class GitCLIService { * @param remote [optional] remote to which the branch should be pushed to, by default 'origin' */ async push(cwd, branch, remote = "origin", force = false) { - this.logger.info(`Pushing ${branch} to ${remote}.`); + this.logger.info(`Pushing ${branch} to ${remote}`); const options = ["--quiet"]; if (force) { options.push("--force-with-lease"); @@ -505,9 +505,10 @@ const gitlab_client_1 = __importDefault(__nccwpck_require__(4077)); * Singleton git service factory class */ class GitClientFactory { + // this method assumes there already exists a singleton client instance, otherwise it will fail static getClient() { if (!GitClientFactory.instance) { - throw new Error("You must call `getOrCreate` method first!"); + throw new Error("You must call `getOrCreate` method first"); } return GitClientFactory.instance; } @@ -518,7 +519,7 @@ class GitClientFactory { */ static getOrCreate(type, authToken, apiUrl) { if (GitClientFactory.instance) { - GitClientFactory.logger.warn("Git service already initialized!"); + GitClientFactory.logger.warn("Git service already initialized"); return GitClientFactory.instance; } this.logger.debug(`Setting up ${type} client: apiUrl=${apiUrl}, token=****`); @@ -534,8 +535,9 @@ class GitClientFactory { } return GitClientFactory.instance; } + // this is used for testing purposes static reset() { - GitClientFactory.logger.warn("Resetting git service!"); + GitClientFactory.logger.warn("Resetting git service"); GitClientFactory.instance = undefined; } } @@ -641,7 +643,7 @@ class GitHubClient { return "noreply@github.com"; } async getPullRequest(owner, repo, prNumber, squash = true) { - this.logger.info(`Getting pull request ${owner}/${repo}/${prNumber}.`); + this.logger.debug(`Fetching pull request ${owner}/${repo}/${prNumber}`); const { data } = await this.octokit.rest.pulls.get({ owner: owner, repo: repo, @@ -670,7 +672,7 @@ class GitHubClient { } // WRITE async createPullRequest(backport) { - this.logger.info(`Creating pull request ${backport.head} -> ${backport.base}.`); + this.logger.info(`Creating pull request ${backport.head} -> ${backport.base}`); this.logger.info(`${JSON.stringify(backport, null, 2)}`); const { data } = await this.octokit.pulls.create({ owner: backport.owner, @@ -809,7 +811,6 @@ const rest_1 = __nccwpck_require__(5375); class OctokitFactory { static getOctokit(token, apiUrl) { if (!OctokitFactory.octokit) { - OctokitFactory.logger.info("Creating octokit instance."); OctokitFactory.octokit = new rest_1.Octokit({ auth: token, userAgent: "kiegroup/git-backporting", @@ -885,7 +886,7 @@ class GitLabClient { } // WRITE async createPullRequest(backport) { - this.logger.info(`Creating pull request ${backport.head} -> ${backport.base}.`); + this.logger.info(`Creating pull request ${backport.head} -> ${backport.base}`); this.logger.info(`${JSON.stringify(backport, null, 2)}`); const projectId = this.getProjectId(backport.owner, backport.repo); const { data } = await this.client.post(`/projects/${projectId}/merge_requests`, { @@ -1075,21 +1076,21 @@ class ConsoleLoggerService { this.verbose = verbose; } trace(message) { - this.logger.log("[TRACE]", message); + this.logger.log("TRACE", message); } debug(message) { if (this.verbose) { - this.logger.log("[DEBUG]", message); + this.logger.log("DEBUG", message); } } info(message) { - this.logger.log("[INFO]", message); + this.logger.log("INFO", message); } warn(message) { - this.logger.log("[WARN]", message); + this.logger.log("WARN", message); } error(message) { - this.logger.log("[ERROR]", message); + this.logger.log("ERROR", message); } } exports["default"] = ConsoleLoggerService; @@ -1135,7 +1136,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); class Logger { log(prefix, ...str) { // eslint-disable-next-line no-console - console.log.apply(console, [prefix, ...str]); + console.log.apply(console, [`[${prefix.padEnd(5)}]`, ...str]); } emptyLine() { this.log("", ""); @@ -1175,12 +1176,12 @@ class Runner { async run() { try { await this.execute(); - this.logger.info("Process succeeded!"); + this.logger.info("Process succeeded"); process.exit(0); } catch (error) { this.logger.error(`${error}`); - this.logger.info("Process failed!"); + this.logger.info("Process failed"); process.exit(1); } } @@ -1191,7 +1192,7 @@ class Runner { // 1. parse args const args = this.argsParser.parse(); if (args.dryRun) { - this.logger.warn("Dry run enabled!"); + this.logger.warn("Dry run enabled"); } // 2. init git service const gitClientType = (0, git_util_1.inferGitClient)(args.pullRequest); @@ -1252,7 +1253,7 @@ class Runner { this.logger.info(`Pull request created: ${prUrl}`); } else { - this.logger.warn("Pull request creation and remote push skipped!"); + this.logger.warn("Pull request creation and remote push skipped"); this.logger.info(`${JSON.stringify(backport, null, 2)}`); } } diff --git a/dist/gha/index.js b/dist/gha/index.js index 5778dce..cf28269 100755 --- a/dist/gha/index.js +++ b/dist/gha/index.js @@ -227,11 +227,11 @@ class ConfigsParser { // apply validation, throw errors if something is wrong // if pr is opened check if the there exists one single commit if (configs.originalPullRequest.state == "open") { - this.logger.warn("Trying to backport an open pull request!"); + this.logger.warn("Trying to backport an open pull request"); } - // if PR is closed and not merged log a warning + // if PR is closed and not merged throw an error if (configs.originalPullRequest.state == "closed" && !configs.originalPullRequest.merged) { - throw new Error("Provided pull request is closed and not merged!"); + throw new Error("Provided pull request is closed and not merged"); } return Promise.resolve(configs); } @@ -383,7 +383,7 @@ class GitCLIService { * @param branch branch which should be cloned */ async clone(from, to, branch) { - this.logger.info(`Cloning repository ${from} to ${to}.`); + this.logger.info(`Cloning repository ${from} to ${to}`); if (!fs_1.default.existsSync(to)) { await (0, simple_git_1.default)().clone(this.remoteWithAuth(from), to, ["--quiet", "--shallow-submodules", "--no-tags", "--branch", branch]); } @@ -397,7 +397,7 @@ class GitCLIService { * @param newBranch new branch name */ async createLocalBranch(cwd, newBranch) { - this.logger.info(`Creating branch ${newBranch}.`); + this.logger.info(`Creating branch ${newBranch}`); await this.git(cwd).checkoutLocalBranch(newBranch); } /** @@ -407,7 +407,7 @@ class GitCLIService { * @param remoteName [optional] name of the remote, by default 'fork' is used */ async addRemote(cwd, remote, remoteName = "fork") { - this.logger.info(`Adding new remote ${remote}.`); + this.logger.info(`Adding new remote ${remote}`); await this.git(cwd).addRemote(remoteName, this.remoteWithAuth(remote)); } /** @@ -417,7 +417,7 @@ class GitCLIService { * @param remote [optional] the remote to fetch, by default origin */ async fetch(cwd, branch, remote = "origin") { - this.logger.info(`Fetching ${remote} ${branch}.`); + this.logger.info(`Fetching ${remote} ${branch}`); await this.git(cwd).fetch(remote, branch, ["--quiet"]); } /** @@ -426,7 +426,7 @@ class GitCLIService { * @param sha commit sha */ async cherryPick(cwd, sha, strategy = "recursive", strategyOption = "theirs") { - this.logger.info(`Cherry picking ${sha}.`); + this.logger.info(`Cherry picking ${sha}`); const options = ["cherry-pick", "-m", "1", `--strategy=${strategy}`, `--strategy-option=${strategyOption}`, sha]; try { await this.git(cwd).raw(options); @@ -446,7 +446,7 @@ class GitCLIService { * @param remote [optional] remote to which the branch should be pushed to, by default 'origin' */ async push(cwd, branch, remote = "origin", force = false) { - this.logger.info(`Pushing ${branch} to ${remote}.`); + this.logger.info(`Pushing ${branch} to ${remote}`); const options = ["--quiet"]; if (force) { options.push("--force-with-lease"); @@ -476,9 +476,10 @@ const gitlab_client_1 = __importDefault(__nccwpck_require__(4077)); * Singleton git service factory class */ class GitClientFactory { + // this method assumes there already exists a singleton client instance, otherwise it will fail static getClient() { if (!GitClientFactory.instance) { - throw new Error("You must call `getOrCreate` method first!"); + throw new Error("You must call `getOrCreate` method first"); } return GitClientFactory.instance; } @@ -489,7 +490,7 @@ class GitClientFactory { */ static getOrCreate(type, authToken, apiUrl) { if (GitClientFactory.instance) { - GitClientFactory.logger.warn("Git service already initialized!"); + GitClientFactory.logger.warn("Git service already initialized"); return GitClientFactory.instance; } this.logger.debug(`Setting up ${type} client: apiUrl=${apiUrl}, token=****`); @@ -505,8 +506,9 @@ class GitClientFactory { } return GitClientFactory.instance; } + // this is used for testing purposes static reset() { - GitClientFactory.logger.warn("Resetting git service!"); + GitClientFactory.logger.warn("Resetting git service"); GitClientFactory.instance = undefined; } } @@ -612,7 +614,7 @@ class GitHubClient { return "noreply@github.com"; } async getPullRequest(owner, repo, prNumber, squash = true) { - this.logger.info(`Getting pull request ${owner}/${repo}/${prNumber}.`); + this.logger.debug(`Fetching pull request ${owner}/${repo}/${prNumber}`); const { data } = await this.octokit.rest.pulls.get({ owner: owner, repo: repo, @@ -641,7 +643,7 @@ class GitHubClient { } // WRITE async createPullRequest(backport) { - this.logger.info(`Creating pull request ${backport.head} -> ${backport.base}.`); + this.logger.info(`Creating pull request ${backport.head} -> ${backport.base}`); this.logger.info(`${JSON.stringify(backport, null, 2)}`); const { data } = await this.octokit.pulls.create({ owner: backport.owner, @@ -780,7 +782,6 @@ const rest_1 = __nccwpck_require__(5375); class OctokitFactory { static getOctokit(token, apiUrl) { if (!OctokitFactory.octokit) { - OctokitFactory.logger.info("Creating octokit instance."); OctokitFactory.octokit = new rest_1.Octokit({ auth: token, userAgent: "kiegroup/git-backporting", @@ -856,7 +857,7 @@ class GitLabClient { } // WRITE async createPullRequest(backport) { - this.logger.info(`Creating pull request ${backport.head} -> ${backport.base}.`); + this.logger.info(`Creating pull request ${backport.head} -> ${backport.base}`); this.logger.info(`${JSON.stringify(backport, null, 2)}`); const projectId = this.getProjectId(backport.owner, backport.repo); const { data } = await this.client.post(`/projects/${projectId}/merge_requests`, { @@ -1046,21 +1047,21 @@ class ConsoleLoggerService { this.verbose = verbose; } trace(message) { - this.logger.log("[TRACE]", message); + this.logger.log("TRACE", message); } debug(message) { if (this.verbose) { - this.logger.log("[DEBUG]", message); + this.logger.log("DEBUG", message); } } info(message) { - this.logger.log("[INFO]", message); + this.logger.log("INFO", message); } warn(message) { - this.logger.log("[WARN]", message); + this.logger.log("WARN", message); } error(message) { - this.logger.log("[ERROR]", message); + this.logger.log("ERROR", message); } } exports["default"] = ConsoleLoggerService; @@ -1106,7 +1107,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); class Logger { log(prefix, ...str) { // eslint-disable-next-line no-console - console.log.apply(console, [prefix, ...str]); + console.log.apply(console, [`[${prefix.padEnd(5)}]`, ...str]); } emptyLine() { this.log("", ""); @@ -1146,12 +1147,12 @@ class Runner { async run() { try { await this.execute(); - this.logger.info("Process succeeded!"); + this.logger.info("Process succeeded"); process.exit(0); } catch (error) { this.logger.error(`${error}`); - this.logger.info("Process failed!"); + this.logger.info("Process failed"); process.exit(1); } } @@ -1162,7 +1163,7 @@ class Runner { // 1. parse args const args = this.argsParser.parse(); if (args.dryRun) { - this.logger.warn("Dry run enabled!"); + this.logger.warn("Dry run enabled"); } // 2. init git service const gitClientType = (0, git_util_1.inferGitClient)(args.pullRequest); @@ -1223,7 +1224,7 @@ class Runner { this.logger.info(`Pull request created: ${prUrl}`); } else { - this.logger.warn("Pull request creation and remote push skipped!"); + this.logger.warn("Pull request creation and remote push skipped"); this.logger.info(`${JSON.stringify(backport, null, 2)}`); } } diff --git a/src/service/configs/configs-parser.ts b/src/service/configs/configs-parser.ts index e21ed08..5b901cb 100644 --- a/src/service/configs/configs-parser.ts +++ b/src/service/configs/configs-parser.ts @@ -24,12 +24,12 @@ import LoggerServiceFactory from "../logger/logger-service-factory"; // if pr is opened check if the there exists one single commit if (configs.originalPullRequest.state == "open") { - this.logger.warn("Trying to backport an open pull request!"); + this.logger.warn("Trying to backport an open pull request"); } - // if PR is closed and not merged log a warning + // if PR is closed and not merged throw an error if (configs.originalPullRequest.state == "closed" && !configs.originalPullRequest.merged) { - throw new Error("Provided pull request is closed and not merged!"); + throw new Error("Provided pull request is closed and not merged"); } return Promise.resolve(configs); diff --git a/src/service/git/git-cli.ts b/src/service/git/git-cli.ts index c0b439e..26239a7 100644 --- a/src/service/git/git-cli.ts +++ b/src/service/git/git-cli.ts @@ -60,7 +60,7 @@ export default class GitCLIService { * @param branch branch which should be cloned */ async clone(from: string, to: string, branch: string): Promise { - this.logger.info(`Cloning repository ${from} to ${to}.`); + this.logger.info(`Cloning repository ${from} to ${to}`); if (!fs.existsSync(to)) { await simpleGit().clone(this.remoteWithAuth(from), to, ["--quiet", "--shallow-submodules", "--no-tags", "--branch", branch]); } else { @@ -74,7 +74,7 @@ export default class GitCLIService { * @param newBranch new branch name */ async createLocalBranch(cwd: string, newBranch: string): Promise { - this.logger.info(`Creating branch ${newBranch}.`); + this.logger.info(`Creating branch ${newBranch}`); await this.git(cwd).checkoutLocalBranch(newBranch); } @@ -85,7 +85,7 @@ export default class GitCLIService { * @param remoteName [optional] name of the remote, by default 'fork' is used */ async addRemote(cwd: string, remote: string, remoteName = "fork"): Promise { - this.logger.info(`Adding new remote ${remote}.`); + this.logger.info(`Adding new remote ${remote}`); await this.git(cwd).addRemote(remoteName, this.remoteWithAuth(remote)); } @@ -96,7 +96,7 @@ export default class GitCLIService { * @param remote [optional] the remote to fetch, by default origin */ async fetch(cwd: string, branch: string, remote = "origin"): Promise { - this.logger.info(`Fetching ${remote} ${branch}.`); + this.logger.info(`Fetching ${remote} ${branch}`); await this.git(cwd).fetch(remote, branch, ["--quiet"]); } @@ -106,7 +106,7 @@ export default class GitCLIService { * @param sha commit sha */ async cherryPick(cwd: string, sha: string, strategy = "recursive", strategyOption = "theirs"): Promise { - this.logger.info(`Cherry picking ${sha}.`); + this.logger.info(`Cherry picking ${sha}`); const options = ["cherry-pick", "-m", "1", `--strategy=${strategy}`, `--strategy-option=${strategyOption}`, sha]; try { @@ -128,7 +128,7 @@ export default class GitCLIService { * @param remote [optional] remote to which the branch should be pushed to, by default 'origin' */ async push(cwd: string, branch: string, remote = "origin", force = false): Promise { - this.logger.info(`Pushing ${branch} to ${remote}.`); + this.logger.info(`Pushing ${branch} to ${remote}`); const options = ["--quiet"]; if (force) { diff --git a/src/service/git/git-client-factory.ts b/src/service/git/git-client-factory.ts index 890863a..fa63173 100644 --- a/src/service/git/git-client-factory.ts +++ b/src/service/git/git-client-factory.ts @@ -13,9 +13,10 @@ export default class GitClientFactory { private static logger: LoggerService = LoggerServiceFactory.getLogger(); private static instance?: GitClient; + // this method assumes there already exists a singleton client instance, otherwise it will fail public static getClient(): GitClient { if (!GitClientFactory.instance) { - throw new Error("You must call `getOrCreate` method first!"); + throw new Error("You must call `getOrCreate` method first"); } return GitClientFactory.instance; @@ -29,7 +30,7 @@ export default class GitClientFactory { public static getOrCreate(type: GitClientType, authToken: string | undefined, apiUrl: string): GitClient { if (GitClientFactory.instance) { - GitClientFactory.logger.warn("Git service already initialized!"); + GitClientFactory.logger.warn("Git service already initialized"); return GitClientFactory.instance; } @@ -49,8 +50,9 @@ export default class GitClientFactory { return GitClientFactory.instance; } + // this is used for testing purposes public static reset(): void { - GitClientFactory.logger.warn("Resetting git service!"); + GitClientFactory.logger.warn("Resetting git service"); GitClientFactory.instance = undefined; } } \ No newline at end of file diff --git a/src/service/git/github/github-client.ts b/src/service/git/github/github-client.ts index 012736b..0da22df 100644 --- a/src/service/git/github/github-client.ts +++ b/src/service/git/github/github-client.ts @@ -32,7 +32,7 @@ export default class GitHubClient implements GitClient { } async getPullRequest(owner: string, repo: string, prNumber: number, squash = true): Promise { - this.logger.info(`Getting pull request ${owner}/${repo}/${prNumber}.`); + this.logger.debug(`Fetching pull request ${owner}/${repo}/${prNumber}`); const { data } = await this.octokit.rest.pulls.get({ owner: owner, repo: repo, @@ -66,7 +66,7 @@ export default class GitHubClient implements GitClient { // WRITE async createPullRequest(backport: BackportPullRequest): Promise { - this.logger.info(`Creating pull request ${backport.head} -> ${backport.base}.`); + this.logger.info(`Creating pull request ${backport.head} -> ${backport.base}`); this.logger.info(`${JSON.stringify(backport, null, 2)}`); const { data } = await this.octokit.pulls.create({ diff --git a/src/service/git/github/octokit-factory.ts b/src/service/git/github/octokit-factory.ts index e63f486..7792ed6 100644 --- a/src/service/git/github/octokit-factory.ts +++ b/src/service/git/github/octokit-factory.ts @@ -12,7 +12,6 @@ export default class OctokitFactory { public static getOctokit(token: string | undefined, apiUrl: string): Octokit { if (!OctokitFactory.octokit) { - OctokitFactory.logger.info("Creating octokit instance."); OctokitFactory.octokit = new Octokit({ auth: token, userAgent: "kiegroup/git-backporting", diff --git a/src/service/git/gitlab/gitlab-client.ts b/src/service/git/gitlab/gitlab-client.ts index 3607c45..725eacb 100644 --- a/src/service/git/gitlab/gitlab-client.ts +++ b/src/service/git/gitlab/gitlab-client.ts @@ -69,7 +69,7 @@ export default class GitLabClient implements GitClient { // WRITE async createPullRequest(backport: BackportPullRequest): Promise { - this.logger.info(`Creating pull request ${backport.head} -> ${backport.base}.`); + this.logger.info(`Creating pull request ${backport.head} -> ${backport.base}`); this.logger.info(`${JSON.stringify(backport, null, 2)}`); const projectId = this.getProjectId(backport.owner, backport.repo); diff --git a/src/service/logger/console-logger-service.ts b/src/service/logger/console-logger-service.ts index 3a313eb..ee9339b 100644 --- a/src/service/logger/console-logger-service.ts +++ b/src/service/logger/console-logger-service.ts @@ -12,25 +12,25 @@ export default class ConsoleLoggerService implements LoggerService { } trace(message: string): void { - this.logger.log("[TRACE]", message); + this.logger.log("TRACE", message); } debug(message: string): void { if (this.verbose) { - this.logger.log("[DEBUG]", message); + this.logger.log("DEBUG", message); } } info(message: string): void { - this.logger.log("[INFO]", message); + this.logger.log("INFO", message); } warn(message: string): void { - this.logger.log("[WARN]", message); + this.logger.log("WARN", message); } error(message: string): void { - this.logger.log("[ERROR]", message); + this.logger.log("ERROR", message); } } \ No newline at end of file diff --git a/src/service/logger/logger.ts b/src/service/logger/logger.ts index f058525..18f76e5 100644 --- a/src/service/logger/logger.ts +++ b/src/service/logger/logger.ts @@ -6,7 +6,7 @@ log(prefix: string, ...str: string[]) { // eslint-disable-next-line no-console - console.log.apply(console, [prefix, ...str]); + console.log.apply(console, [`[${prefix.padEnd(5)}]`, ...str]); } emptyLine() { diff --git a/src/service/runner/runner.ts b/src/service/runner/runner.ts index 2060e30..2ad5364 100644 --- a/src/service/runner/runner.ts +++ b/src/service/runner/runner.ts @@ -30,13 +30,13 @@ export default class Runner { try { await this.execute(); - this.logger.info("Process succeeded!"); + this.logger.info("Process succeeded"); process.exit(0); } catch (error) { this.logger.error(`${error}`); - this.logger.info("Process failed!"); + this.logger.info("Process failed"); process.exit(1); } } @@ -50,7 +50,7 @@ export default class Runner { const args: Args = this.argsParser.parse(); if (args.dryRun) { - this.logger.warn("Dry run enabled!"); + this.logger.warn("Dry run enabled"); } // 2. init git service @@ -123,7 +123,7 @@ export default class Runner { this.logger.info(`Pull request created: ${prUrl}`); } else { - this.logger.warn("Pull request creation and remote push skipped!"); + this.logger.warn("Pull request creation and remote push skipped"); this.logger.info(`${JSON.stringify(backport, null, 2)}`); } } diff --git a/test/service/configs/pullrequest/github-pr-configs-parser.test.ts b/test/service/configs/pullrequest/github-pr-configs-parser.test.ts index 4b8b40b..950c01f 100644 --- a/test/service/configs/pullrequest/github-pr-configs-parser.test.ts +++ b/test/service/configs/pullrequest/github-pr-configs-parser.test.ts @@ -247,7 +247,7 @@ describe("github pull request config parser", () => { inheritReviewers: true, }; - await expect(() => configParser.parseAndValidate(args)).rejects.toThrow("Provided pull request is closed and not merged!"); + await expect(() => configParser.parseAndValidate(args)).rejects.toThrow("Provided pull request is closed and not merged"); }); test("override backport pr data inheriting reviewers", async () => { diff --git a/test/service/configs/pullrequest/gitlab-pr-configs-parser.test.ts b/test/service/configs/pullrequest/gitlab-pr-configs-parser.test.ts index f180a78..8e10d17 100644 --- a/test/service/configs/pullrequest/gitlab-pr-configs-parser.test.ts +++ b/test/service/configs/pullrequest/gitlab-pr-configs-parser.test.ts @@ -253,7 +253,7 @@ describe("gitlab merge request config parser", () => { inheritReviewers: true, }; - await expect(() => configParser.parseAndValidate(args)).rejects.toThrow("Provided pull request is closed and not merged!"); + await expect(() => configParser.parseAndValidate(args)).rejects.toThrow("Provided pull request is closed and not merged"); }); test("override backport pr data inheriting reviewers", async () => { diff --git a/test/service/runner/cli-github-runner.test.ts b/test/service/runner/cli-github-runner.test.ts index 39b5e83..f70d446 100644 --- a/test/service/runner/cli-github-runner.test.ts +++ b/test/service/runner/cli-github-runner.test.ts @@ -289,7 +289,7 @@ describe("cli runner", () => { "https://github.com/owner/reponame/pull/6666" ]); - await expect(() => runner.execute()).rejects.toThrow("Provided pull request is closed and not merged!"); + await expect(() => runner.execute()).rejects.toThrow("Provided pull request is closed and not merged"); }); test("open pull request", async () => { diff --git a/test/service/runner/cli-gitlab-runner.test.ts b/test/service/runner/cli-gitlab-runner.test.ts index c07e46d..c13be27 100644 --- a/test/service/runner/cli-gitlab-runner.test.ts +++ b/test/service/runner/cli-gitlab-runner.test.ts @@ -193,7 +193,7 @@ describe("cli runner", () => { "https://my.gitlab.host.com/superuser/backporting-example/-/merge_requests/3" ]); - await expect(() => runner.execute()).rejects.toThrow("Provided pull request is closed and not merged!"); + await expect(() => runner.execute()).rejects.toThrow("Provided pull request is closed and not merged"); }); test("merged pull request", async () => { diff --git a/test/service/runner/gha-github-runner.test.ts b/test/service/runner/gha-github-runner.test.ts index 9cbeeb9..69de6d0 100644 --- a/test/service/runner/gha-github-runner.test.ts +++ b/test/service/runner/gha-github-runner.test.ts @@ -135,7 +135,7 @@ describe("gha runner", () => { "pull-request": "https://github.com/owner/reponame/pull/6666" }); - await expect(() => runner.execute()).rejects.toThrow("Provided pull request is closed and not merged!"); + await expect(() => runner.execute()).rejects.toThrow("Provided pull request is closed and not merged"); }); test("open pull request", async () => { diff --git a/test/service/runner/gha-gitlab-runner.test.ts b/test/service/runner/gha-gitlab-runner.test.ts index b408c2b..4610cee 100644 --- a/test/service/runner/gha-gitlab-runner.test.ts +++ b/test/service/runner/gha-gitlab-runner.test.ts @@ -146,7 +146,7 @@ describe("gha runner", () => { "pull-request": "https://my.gitlab.host.com/superuser/backporting-example/-/merge_requests/3" }); - await expect(() => runner.execute()).rejects.toThrow("Provided pull request is closed and not merged!"); + await expect(() => runner.execute()).rejects.toThrow("Provided pull request is closed and not merged"); }); test("merged pull request", async () => { diff --git a/test/support/mock/git-client-mock-support.ts b/test/support/mock/git-client-mock-support.ts index 6a3b4a8..02597f7 100644 --- a/test/support/mock/git-client-mock-support.ts +++ b/test/support/mock/git-client-mock-support.ts @@ -79,7 +79,7 @@ export const putAxiosMocked = async (url: string, _data?: unknown) => { // GITHUB - OCTOKIT export const mockGitHubClient = (apiUrl = "https://api.github.com"): Moctokit => { - logger.debug("Setting up moctokit."); + logger.debug("Setting up moctokit.."); const mock = new Moctokit(apiUrl);