diff --git a/dist/cli/index.js b/dist/cli/index.js index c46ef8f..258fc9a 100755 --- a/dist/cli/index.js +++ b/dist/cli/index.js @@ -1619,7 +1619,15 @@ class Runner { } // 7. apply all changes to the new branch this.logger.debug("Cherry picking commits.."); - for (const sha of originalPR.commits.reverse()) { + // Commits might be ordered in different ways based on the git service, e.g., considering top to bottom + // GITHUB --> oldest to newest + // CODEBERG --> newest to oldest + // GITLAB --> newest to oldest + if (git.gitClientType === git_types_1.GitClientType.CODEBERG || git.gitClientType === git_types_1.GitClientType.GITLAB) { + // reverse the order as we always need to process from older to newest + originalPR.commits.reverse(); + } + for (const sha of originalPR.commits) { await git.gitCli.cherryPick(configs.folder, sha, configs.mergeStrategy, configs.mergeStrategyOption, configs.cherryPickOptions); } if (!configs.dryRun) { diff --git a/dist/gha/index.js b/dist/gha/index.js index 8c9f93d..281e099 100755 --- a/dist/gha/index.js +++ b/dist/gha/index.js @@ -1584,7 +1584,15 @@ class Runner { } // 7. apply all changes to the new branch this.logger.debug("Cherry picking commits.."); - for (const sha of originalPR.commits.reverse()) { + // Commits might be ordered in different ways based on the git service, e.g., considering top to bottom + // GITHUB --> oldest to newest + // CODEBERG --> newest to oldest + // GITLAB --> newest to oldest + if (git.gitClientType === git_types_1.GitClientType.CODEBERG || git.gitClientType === git_types_1.GitClientType.GITLAB) { + // reverse the order as we always need to process from older to newest + originalPR.commits.reverse(); + } + for (const sha of originalPR.commits) { await git.gitCli.cherryPick(configs.folder, sha, configs.mergeStrategy, configs.mergeStrategyOption, configs.cherryPickOptions); } if (!configs.dryRun) { diff --git a/src/service/runner/runner.ts b/src/service/runner/runner.ts index c45f993..fed7a70 100644 --- a/src/service/runner/runner.ts +++ b/src/service/runner/runner.ts @@ -152,7 +152,15 @@ export default class Runner { // 7. apply all changes to the new branch this.logger.debug("Cherry picking commits.."); - for (const sha of originalPR.commits.reverse()!) { + // Commits might be ordered in different ways based on the git service, e.g., considering top to bottom + // GITHUB --> oldest to newest + // CODEBERG --> newest to oldest + // GITLAB --> newest to oldest + if (git.gitClientType === GitClientType.CODEBERG || git.gitClientType === GitClientType.GITLAB) { + // reverse the order as we always need to process from older to newest + originalPR.commits.reverse(); + } + for (const sha of originalPR.commits) { await git.gitCli.cherryPick(configs.folder, sha, configs.mergeStrategy, configs.mergeStrategyOption, configs.cherryPickOptions); } diff --git a/test/service/runner/cli-codeberg-runner.test.ts b/test/service/runner/cli-codeberg-runner.test.ts new file mode 100644 index 0000000..8ea6a1c --- /dev/null +++ b/test/service/runner/cli-codeberg-runner.test.ts @@ -0,0 +1,1376 @@ +import ArgsParser from "@bp/service/args/args-parser"; +import Runner from "@bp/service/runner/runner"; +import GitCLIService from "@bp/service/git/git-cli"; +import GitHubClient from "@bp/service/git/github/github-client"; +import CLIArgsParser from "@bp/service/args/cli/cli-args-parser"; +import { addProcessArgs, createTestFile, removeTestFile, resetEnvTokens, resetProcessArgs } from "../../support/utils"; +import { mockCodebergClient } from "../../support/mock/git-client-mock-support"; +import GitClientFactory from "@bp/service/git/git-client-factory"; +import { BackportPullRequest, GitClientType } from "@bp/service/git/git.types"; +import { AuthTokenId } from "@bp/service/configs/configs.types"; + +const GITHUB_MERGED_PR_W_OVERRIDES_CONFIG_FILE_CONTENT_PATHNAME = "./cli-codeberg-runner-pr-merged-with-overrides.json"; +const GITHUB_MERGED_PR_W_OVERRIDES_CONFIG_FILE_CONTENT = { + "dryRun": false, + "auth": "my-auth-token", + "pullRequest": "https://codeberg.org/owner/reponame/pulls/2368", + "targetBranch": "target", + "gitUser": "Me", + "gitEmail": "me@email.com", + "title": "New Title", + "body": "New Body", + "bodyPrefix": "New Body Prefix - ", + "bpBranchName": "bp_branch_name", + "reviewers": [], + "assignees": ["user3", "user4"], + "inheritReviewers": false, + "labels": ["cli github cherry pick :cherries:"], + "inheritLabels": true, +}; + +jest.mock("@bp/service/git/git-cli"); +jest.spyOn(GitHubClient.prototype, "createPullRequest"); +jest.spyOn(GitHubClient.prototype, "createPullRequestComment"); +jest.spyOn(GitClientFactory, "getOrCreate"); + +let parser: ArgsParser; +let runner: Runner; + +beforeAll(() => { + // create a temporary file + createTestFile(GITHUB_MERGED_PR_W_OVERRIDES_CONFIG_FILE_CONTENT_PATHNAME, JSON.stringify(GITHUB_MERGED_PR_W_OVERRIDES_CONFIG_FILE_CONTENT)); +}); + +afterAll(() => { + // clean up all temporary files + removeTestFile(GITHUB_MERGED_PR_W_OVERRIDES_CONFIG_FILE_CONTENT_PATHNAME); +}); + +beforeEach(() => { + // reset process.env variables + resetProcessArgs(); + + // reset git env tokens + resetEnvTokens(); + + // mock octokit + mockCodebergClient(); + + // create CLI arguments parser + parser = new CLIArgsParser(); + + // create runner + runner = new Runner(parser); +}); + +describe("cli runner", () => { + + test("with dry run", async () => { + addProcessArgs([ + "-d", + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/2368" + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/bp"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp-target-28f63db"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(1); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(1); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(0); + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(0); + expect(GitHubClient.prototype.createPullRequestComment).toBeCalledTimes(0); + }); + + test("overriding author", async () => { + addProcessArgs([ + "-d", + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/2368" + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/bp"; + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp-target-28f63db"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(1); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(1); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(0); + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(0); + }); + + test("with relative folder", async () => { + addProcessArgs([ + "-d", + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/2368", + "-f", + "folder" + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/folder"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp-target-28f63db"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(1); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(1); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.addRemote).toBeCalledTimes(0); + expect(GitCLIService.prototype.addRemote).toBeCalledTimes(0); + + expect(GitCLIService.prototype.push).toBeCalledTimes(0); + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(0); + }); + + test("with absolute folder", async () => { + addProcessArgs([ + "-d", + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/2368", + "-f", + "/tmp/folder" + ]); + + await runner.execute(); + + const cwd = "/tmp/folder"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp-target-28f63db"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(1); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(1); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(0); + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(0); + }); + + test("without dry run", async () => { + addProcessArgs([ + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/2368" + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/bp"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp-target-28f63db"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(1); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(1); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(1); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp-target-28f63db"); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(1); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "bp-target-28f63db", + base: "target", + title: "[target] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/2368\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + } + ); + expect(GitHubClient.prototype.createPullRequest).toReturnTimes(1); + }); + + test("same owner", async () => { + addProcessArgs([ + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/8632" + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/bp"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp-target-28f63db"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(0); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(1); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(1); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp-target-28f63db"); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(1); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "bp-target-28f63db", + base: "target", + title: "[target] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/8632\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + } + ); + expect(GitHubClient.prototype.createPullRequest).toReturnTimes(1); + expect(GitHubClient.prototype.createPullRequestComment).toBeCalledTimes(0); + }); + + test("closed and not merged pull request", async () => { + addProcessArgs([ + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/6666" + ]); + + await expect(() => runner.execute()).rejects.toThrow("Provided pull request is closed and not merged"); + }); + + test("open pull request simple", async () => { + addProcessArgs([ + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/4444" + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/bp"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp-target-9174896"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(1); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/4444/head:pr/4444"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(1); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "91748965051fae1330ad58d15cf694e103267c87", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(1); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp-target-9174896"); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(1); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "bp-target-9174896", + base: "target", + title: "[target] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/4444\r\n\r\nPlease review and merge", + reviewers: ["gh-user"], + assignees: [], + labels: [], + comments: [], + } + ); + expect(GitHubClient.prototype.createPullRequest).toReturnTimes(1); + }); + + test("open pull request with --auto-no-squash", async () => { + addProcessArgs([ + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/4444", + "--auto-no-squash", + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/bp"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp-target-0404fb9-11da4e3"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(1); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/4444/head:pr/4444"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(2); + expect(GitCLIService.prototype.cherryPick).toHaveBeenLastCalledWith(cwd, "0404fb922ab75c3a8aecad5c97d9af388df04695", undefined, undefined, undefined); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "11da4e38aa3e577ffde6d546f1c52e53b04d3151", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(1); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp-target-0404fb9-11da4e3"); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(1); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "bp-target-0404fb9-11da4e3", + base: "target", + title: "[target] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/4444\r\n\r\nPlease review and merge", + reviewers: ["gh-user"], + assignees: [], + labels: [], + comments: [], + } + ); + expect(GitHubClient.prototype.createPullRequest).toReturnTimes(1); + }); + + test("override backporting pr data", async () => { + addProcessArgs([ + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/2368", + "--title", + "New Title", + "--body", + "New Body", + "--body-prefix", + "New Body Prefix\\r\\n\\r\\n", + "--bp-branch-name", + "bp_branch_name", + "--reviewers", + "user1,user2", + "--assignees", + "user3,user4", + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/bp"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp_branch_name"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(1); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(1); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(1); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp_branch_name"); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(1); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "bp_branch_name", + base: "target", + title: "New Title", + body: "New Body Prefix\r\n\r\nNew Body", + reviewers: ["user1", "user2"], + assignees: ["user3", "user4"], + labels: [], + comments: [], + } + ); + expect(GitHubClient.prototype.createPullRequest).toReturnTimes(1); + }); + + test("set empty reviewers", async () => { + addProcessArgs([ + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/2368", + "--title", + "New Title", + "--body", + "New Body", + "--body-prefix", + "New Body Prefix - ", + "--bp-branch-name", + "bp_branch_name", + "--no-inherit-reviewers", + "--assignees", + "user3,user4", + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/bp"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp_branch_name"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(1); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(1); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(1); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp_branch_name"); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(1); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "bp_branch_name", + base: "target", + title: "New Title", + body: "New Body Prefix - New Body", + reviewers: [], + assignees: ["user3", "user4"], + labels: [], + comments: [], + } + ); + expect(GitHubClient.prototype.createPullRequest).toReturnTimes(1); + }); + + test("set custom labels with inheritance", async () => { + addProcessArgs([ + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/2368", + "--labels", + "cherry-pick :cherries:, backport prod", + "--inherit-labels", + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/bp"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp-target-28f63db"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(1); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(1); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(1); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp-target-28f63db"); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(1); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "bp-target-28f63db", + base: "target", + title: "[target] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/2368\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: ["cherry-pick :cherries:", "backport prod"], + comments: [], + } + ); + expect(GitHubClient.prototype.createPullRequest).toReturnTimes(1); + }); + + test("set custom labels without inheritance", async () => { + addProcessArgs([ + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/2368", + "--labels", + "first-label, second-label ", + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/bp"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp-target-28f63db"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(1); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(1); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(1); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp-target-28f63db"); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(1); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "bp-target-28f63db", + base: "target", + title: "[target] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/2368\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: ["first-label", "second-label"], + comments: [], + } + ); + expect(GitHubClient.prototype.createPullRequest).toReturnTimes(1); + }); + + test("using config file with overrides", async () => { + addProcessArgs([ + "--config-file", + GITHUB_MERGED_PR_W_OVERRIDES_CONFIG_FILE_CONTENT_PATHNAME, + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/bp"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, "my-auth-token", "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp_branch_name"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(1); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(1); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(1); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp_branch_name"); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(1); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "bp_branch_name", + base: "target", + title: "New Title", + body: "New Body Prefix - New Body", + reviewers: [], + assignees: ["user3", "user4"], + labels: ["cli github cherry pick :cherries:", "backport prod"], + comments: [], + } + ); + expect(GitHubClient.prototype.createPullRequest).toReturnTimes(1); + }); + + // to check: https://codeberg.org/kiegroup/git-backporting/issues/52 + test("using codeberg api url instead of html one", async () => { + addProcessArgs([ + "-tb", + "target", + "-pr", + "https://codeberg.org/api/v1/repos/owner/reponame/pulls/2368" + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/bp"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp-target-28f63db"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(1); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(1); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(1); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp-target-28f63db"); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(1); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "bp-target-28f63db", + base: "target", + title: "[target] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/2368\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + } + ); + expect(GitHubClient.prototype.createPullRequest).toReturnTimes(1); + }); + + test("multiple commits pr", async () => { + addProcessArgs([ + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/8632", + "--no-squash", + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/bp"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp-target-0404fb9-11da4e3"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(0); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(2); + expect(GitCLIService.prototype.cherryPick).toHaveBeenLastCalledWith(cwd, "0404fb922ab75c3a8aecad5c97d9af388df04695", undefined, undefined, undefined); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "11da4e38aa3e577ffde6d546f1c52e53b04d3151", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(1); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp-target-0404fb9-11da4e3"); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(1); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "bp-target-0404fb9-11da4e3", + base: "target", + title: "[target] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/8632\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + } + ); + expect(GitHubClient.prototype.createPullRequest).toReturnTimes(1); + }); + + test("too long bp branch name", async () => { + // 260 chars + const tooLongBranchName = "too-long-branch-name".repeat(13); + + addProcessArgs([ + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/2368", + "--bp-branch-name", + tooLongBranchName, + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/bp"; + + const truncatedBranch = tooLongBranchName.slice(0, 250); + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, truncatedBranch); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(1); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(1); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(1); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, truncatedBranch); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(1); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: truncatedBranch, + base: "target", + title: "[target] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/2368\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + } + ); + expect(GitHubClient.prototype.createPullRequest).toReturnTimes(1); + }); + + test("multiple commits pr with different strategy", async () => { + addProcessArgs([ + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/8632", + "--no-squash", + "--strategy", + "ort", + "--strategy-option", + "find-renames", + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/bp"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp-target-0404fb9-11da4e3"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(0); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(2); + expect(GitCLIService.prototype.cherryPick).toHaveBeenLastCalledWith(cwd, "0404fb922ab75c3a8aecad5c97d9af388df04695", "ort", "find-renames", undefined); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "11da4e38aa3e577ffde6d546f1c52e53b04d3151", "ort", "find-renames", undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(1); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp-target-0404fb9-11da4e3"); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(1); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "bp-target-0404fb9-11da4e3", + base: "target", + title: "[target] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/8632\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + } + ); + expect(GitHubClient.prototype.createPullRequest).toReturnTimes(1); + }); + + test("additional pr comments", async () => { + addProcessArgs([ + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/8632", + "--comments", + "first comment; second comment", + "--body", + "New body" + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/bp"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "target"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(1); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp-target-28f63db"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(0); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(1); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(1); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp-target-28f63db"); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(1); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "bp-target-28f63db", + base: "target", + title: "[target] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/8632\r\n\r\nNew body", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: ["first comment", "second comment"], + } + ); + expect(GitHubClient.prototype.createPullRequest).toReturnTimes(1); + }); + + test("with multiple target branches", async () => { + addProcessArgs([ + "-tb", + "v1, v2, v3", + "-pr", + "https://codeberg.org/owner/reponame/pulls/2368", + "-f", + "/tmp/folder" + ]); + + await runner.execute(); + + const cwd = "/tmp/folder"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(3); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "v1"); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "v2"); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "v3"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(3); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp-v1-28f63db"); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp-v2-28f63db"); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "bp-v3-28f63db"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(3); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(3); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(3); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp-v1-28f63db"); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp-v2-28f63db"); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp-v3-28f63db"); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(3); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "bp-v1-28f63db", + base: "v1", + title: "[v1] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/2368\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + }); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "bp-v2-28f63db", + base: "v2", + title: "[v2] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/2368\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + }); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "bp-v3-28f63db", + base: "v3", + title: "[v3] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/2368\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + }); + expect(GitHubClient.prototype.createPullRequest).toReturnTimes(3); + }); + + test("with multiple target branches and multiple bp names", async () => { + addProcessArgs([ + "-tb", + "v1, v2, v3", + "-pr", + "https://codeberg.org/owner/reponame/pulls/2368", + "-f", + "/tmp/folder", + "--bp-branch-name", + "custom1, custom1, custom2, custom3", + ]); + + await runner.execute(); + + const cwd = "/tmp/folder"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(3); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "v1"); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "v2"); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "v3"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(3); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "custom1"); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "custom2"); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "custom3"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(3); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(3); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(3); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "custom1"); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "custom2"); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "custom3"); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(3); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "custom1", + base: "v1", + title: "[v1] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/2368\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + }); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "custom2", + base: "v2", + title: "[v2] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/2368\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + }); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "custom3", + base: "v3", + title: "[v3] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/2368\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + }); + expect(GitHubClient.prototype.createPullRequest).toReturnTimes(3); + }); + + test("with multiple target branches and one failure", async () => { + jest.spyOn(GitHubClient.prototype, "createPullRequest").mockImplementation((_backport: BackportPullRequest) => { + + throw new Error("Mocked error"); + }); + + addProcessArgs([ + "-tb", + "v1, v2, v3", + "-pr", + "https://codeberg.org/owner/reponame/pulls/2368", + "-f", + "/tmp/folder", + "--bp-branch-name", + "custom-failure-head", + ]); + + await expect(() => runner.execute()).rejects.toThrowError("Failure occurred during one of the backports: [Error: Mocked error ; Error: Mocked error ; Error: Mocked error]"); + + const cwd = "/tmp/folder"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(3); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "v1"); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "v2"); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "v3"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(3); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "custom-failure-head-v1"); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "custom-failure-head-v2"); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "custom-failure-head-v3"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(3); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(3); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(3); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "custom-failure-head-v1"); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "custom-failure-head-v2"); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "custom-failure-head-v3"); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(3); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "custom-failure-head-v1", + base: "v1", + title: "[v1] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/2368\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + }); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "custom-failure-head-v2", + base: "v2", + title: "[v2] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/2368\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + }); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "custom-failure-head-v3", + base: "v3", + title: "[v3] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/2368\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + }); + expect(GitHubClient.prototype.createPullRequest).toThrowError(); + expect(GitHubClient.prototype.createPullRequestComment).toBeCalledTimes(0); + }); + + test("auth using CODEBERG_TOKEN takes precedence over GIT_TOKEN env variable", async () => { + process.env[AuthTokenId.GIT_TOKEN] = "mygittoken"; + process.env[AuthTokenId.CODEBERG_TOKEN] = "mycodebergtoken"; + addProcessArgs([ + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/8632" + ]); + + await runner.execute(); + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, "mycodebergtoken", "https://codeberg.org/api/v1"); + + // Not interested in all subsequent calls, already tested in other test cases + }); + + test("auth arg takes precedence over CODEBERG_TOKEN", async () => { + process.env[AuthTokenId.CODEBERG_TOKEN] = "mycodebergtoken"; + addProcessArgs([ + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/8632", + "-a", + "mytoken" + ]); + + await runner.execute(); + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, "mytoken", "https://codeberg.org/api/v1"); + + // Not interested in all subsequent calls, already tested in other test cases + }); + + test("ignore env variables related to other git platforms", async () => { + process.env[AuthTokenId.GITLAB_TOKEN] = "mygitlabtoken"; + process.env[AuthTokenId.GITHUB_TOKEN] = "mygithubtoken"; + addProcessArgs([ + "-tb", + "target", + "-pr", + "https://codeberg.org/owner/reponame/pulls/8632" + ]); + + await runner.execute(); + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + // Not interested in all subsequent calls, already tested in other test cases + }); + + test("extract target branch from label", async () => { + addProcessArgs([ + "--target-branch-pattern", + "^backport (?([^ ]+))$", + "-pr", + "https://codeberg.org/owner/reponame/pulls/2368" + ]); + + await runner.execute(); + + const cwd = process.cwd() + "/bp"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(1); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "prod"); + }); + + test("with multiple target branches, one failure and error notification enabled", async () => { + jest.spyOn(GitHubClient.prototype, "createPullRequest").mockImplementation((backport: BackportPullRequest) => { + throw new Error(`Mocked error: ${backport.base}`); + }); + + addProcessArgs([ + "-tb", + "v1, v2, v3", + "-pr", + "https://codeberg.org/owner/reponame/pulls/2368", + "-f", + "/tmp/folder", + "--bp-branch-name", + "custom-failure-head", + "--enable-err-notification", + ]); + + await expect(() => runner.execute()).rejects.toThrowError("Failure occurred during one of the backports: [Error: Mocked error: v1 ; Error: Mocked error: v2 ; Error: Mocked error: v3]"); + + const cwd = "/tmp/folder"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(3); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "v1"); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "v2"); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "v3"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(3); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "custom-failure-head-v1"); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "custom-failure-head-v2"); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "custom-failure-head-v3"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(3); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(3); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", undefined, undefined, undefined); + + expect(GitCLIService.prototype.push).toBeCalledTimes(3); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "custom-failure-head-v1"); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "custom-failure-head-v2"); + expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "custom-failure-head-v3"); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(3); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "custom-failure-head-v1", + base: "v1", + title: "[v1] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/2368\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + }); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "custom-failure-head-v2", + base: "v2", + title: "[v2] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/2368\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + }); + expect(GitHubClient.prototype.createPullRequest).toBeCalledWith({ + owner: "owner", + repo: "reponame", + head: "custom-failure-head-v3", + base: "v3", + title: "[v3] PR Title", + body: "**Backport:** https://codeberg.org/owner/reponame/pulls/2368\r\n\r\nPlease review and merge", + reviewers: ["gh-user", "that-s-a-user"], + assignees: [], + labels: [], + comments: [], + }); + expect(GitHubClient.prototype.createPullRequest).toThrowError(); + expect(GitHubClient.prototype.createPullRequestComment).toBeCalledTimes(3); + expect(GitHubClient.prototype.createPullRequestComment).toBeCalledWith("https://codeberg.org/api/v1/repos/owner/reponame/pulls/2368", "The backport to `v1` failed. Check the latest run for more details."); + expect(GitHubClient.prototype.createPullRequestComment).toBeCalledWith("https://codeberg.org/api/v1/repos/owner/reponame/pulls/2368", "The backport to `v2` failed. Check the latest run for more details."); + expect(GitHubClient.prototype.createPullRequestComment).toBeCalledWith("https://codeberg.org/api/v1/repos/owner/reponame/pulls/2368", "The backport to `v3` failed. Check the latest run for more details."); + }); + + test("with some failures and dry run enabled", async () => { + jest.spyOn(GitCLIService.prototype, "cherryPick").mockImplementation((cwd: string, sha: string) => { + throw new Error(`Forced error: ${sha}`); + }); + + addProcessArgs([ + "-tb", + "v1, v2, v3", + "-pr", + "https://codeberg.org/owner/reponame/pulls/2368", + "-f", + "/tmp/folder", + "--bp-branch-name", + "custom-failure-head", + "--enable-err-notification", + "--dry-run", + ]); + + await expect(() => runner.execute()).rejects.toThrowError("Failure occurred during one of the backports: [Error: Forced error: 28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc ; Error: Forced error: 28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc ; Error: Forced error: 28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc]"); + + const cwd = "/tmp/folder"; + + expect(GitClientFactory.getOrCreate).toBeCalledTimes(1); + expect(GitClientFactory.getOrCreate).toBeCalledWith(GitClientType.CODEBERG, undefined, "https://codeberg.org/api/v1"); + + expect(GitCLIService.prototype.clone).toBeCalledTimes(3); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "v1"); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "v2"); + expect(GitCLIService.prototype.clone).toBeCalledWith("https://codeberg.org/owner/reponame.git", cwd, "v3"); + + expect(GitCLIService.prototype.createLocalBranch).toBeCalledTimes(3); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "custom-failure-head-v1"); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "custom-failure-head-v2"); + expect(GitCLIService.prototype.createLocalBranch).toBeCalledWith(cwd, "custom-failure-head-v3"); + + expect(GitCLIService.prototype.fetch).toBeCalledTimes(3); + expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/2368/head:pr/2368"); + + expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(3); + expect(GitCLIService.prototype.cherryPick).toThrowError(); + + expect(GitCLIService.prototype.push).toBeCalledTimes(0); + + expect(GitHubClient.prototype.createPullRequest).toBeCalledTimes(0); + expect(GitHubClient.prototype.createPullRequestComment).toBeCalledTimes(0); + }); +}); diff --git a/test/service/runner/cli-github-runner.test.ts b/test/service/runner/cli-github-runner.test.ts index 8d5bd43..53a4505 100644 --- a/test/service/runner/cli-github-runner.test.ts +++ b/test/service/runner/cli-github-runner.test.ts @@ -376,8 +376,8 @@ describe("cli runner", () => { expect(GitCLIService.prototype.fetch).toBeCalledWith(cwd, "pull/4444/head:pr/4444"); expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(2); - expect(GitCLIService.prototype.cherryPick).toHaveBeenLastCalledWith(cwd, "0404fb922ab75c3a8aecad5c97d9af388df04695", undefined, undefined, undefined); - expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "11da4e38aa3e577ffde6d546f1c52e53b04d3151", undefined, undefined, undefined); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "0404fb922ab75c3a8aecad5c97d9af388df04695", undefined, undefined, undefined); + expect(GitCLIService.prototype.cherryPick).toHaveBeenLastCalledWith(cwd, "11da4e38aa3e577ffde6d546f1c52e53b04d3151", undefined, undefined, undefined); expect(GitCLIService.prototype.push).toBeCalledTimes(1); expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp-target-0404fb9-11da4e3"); @@ -733,8 +733,8 @@ describe("cli runner", () => { expect(GitCLIService.prototype.fetch).toBeCalledTimes(0); expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(2); - expect(GitCLIService.prototype.cherryPick).toHaveBeenLastCalledWith(cwd, "0404fb922ab75c3a8aecad5c97d9af388df04695", undefined, undefined, undefined); - expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "11da4e38aa3e577ffde6d546f1c52e53b04d3151", undefined, undefined, undefined); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "0404fb922ab75c3a8aecad5c97d9af388df04695", undefined, undefined, undefined); + expect(GitCLIService.prototype.cherryPick).toHaveBeenLastCalledWith(cwd, "11da4e38aa3e577ffde6d546f1c52e53b04d3151", undefined, undefined, undefined); expect(GitCLIService.prototype.push).toBeCalledTimes(1); expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp-target-0404fb9-11da4e3"); @@ -839,8 +839,8 @@ describe("cli runner", () => { expect(GitCLIService.prototype.fetch).toBeCalledTimes(0); expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(2); - expect(GitCLIService.prototype.cherryPick).toHaveBeenLastCalledWith(cwd, "0404fb922ab75c3a8aecad5c97d9af388df04695", "ort", "find-renames", undefined); - expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "11da4e38aa3e577ffde6d546f1c52e53b04d3151", "ort", "find-renames", undefined); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "0404fb922ab75c3a8aecad5c97d9af388df04695", "ort", "find-renames", undefined); + expect(GitCLIService.prototype.cherryPick).toHaveBeenLastCalledWith(cwd, "11da4e38aa3e577ffde6d546f1c52e53b04d3151", "ort", "find-renames", undefined); expect(GitCLIService.prototype.push).toBeCalledTimes(1); expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp-target-0404fb9-11da4e3"); diff --git a/test/service/runner/gha-github-runner.test.ts b/test/service/runner/gha-github-runner.test.ts index e673db7..5461b33 100644 --- a/test/service/runner/gha-github-runner.test.ts +++ b/test/service/runner/gha-github-runner.test.ts @@ -500,8 +500,8 @@ describe("gha runner", () => { expect(GitCLIService.prototype.fetch).toBeCalledTimes(0); expect(GitCLIService.prototype.cherryPick).toBeCalledTimes(2); - expect(GitCLIService.prototype.cherryPick).toHaveBeenLastCalledWith(cwd, "0404fb922ab75c3a8aecad5c97d9af388df04695", undefined, undefined, undefined); - expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "11da4e38aa3e577ffde6d546f1c52e53b04d3151", undefined, undefined, undefined); + expect(GitCLIService.prototype.cherryPick).toBeCalledWith(cwd, "0404fb922ab75c3a8aecad5c97d9af388df04695", undefined, undefined, undefined); + expect(GitCLIService.prototype.cherryPick).toHaveBeenLastCalledWith(cwd, "11da4e38aa3e577ffde6d546f1c52e53b04d3151", undefined, undefined, undefined); expect(GitCLIService.prototype.push).toBeCalledTimes(1); expect(GitCLIService.prototype.push).toBeCalledWith(cwd, "bp-target-0404fb9-11da4e3"); diff --git a/test/support/mock/codeberg-data.ts b/test/support/mock/codeberg-data.ts new file mode 100644 index 0000000..49c271f --- /dev/null +++ b/test/support/mock/codeberg-data.ts @@ -0,0 +1,2002 @@ +export const CB_TARGET_OWNER = "owner"; +export const CB_SOURCE_OWNER = "fork"; +export const CB_REPO = "reponame"; +export const CB_NOT_FOUND_PR_NUMBER = 1; +export const CB_NEW_PR_URL = "new_pr_url"; +export const CB_NEW_PR_NUMBER = 9999; + +export const CB_MERGED_PR_FIXTURE = { + "url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/2368", + "id": 1137188271, + "node_id": "PR_kwDOABTq6s5DyB2v", + "html_url": "https://codeberg.org/owner/reponame/pulls/2368", + "diff_url": "https://codeberg.org/owner/reponame/pulls/2368.diff", + "patch_url": "https://codeberg.org/owner/reponame/pulls/2368.patch", + "issue_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/2368", + "number": 2368, + "state": "closed", + "locked": false, + "title": "PR Title", + "user": { + "login": "gh-user", + "id": 11995863, + "node_id": "MDQ6VXNlcjExOTk1ODYz", + "avatar_url": "https://avatars.codebergusercontent.com/u/11995863?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/gh-user", + "html_url": "https://codeberg.org/gh-user", + "followers_url": "https://codeberg.org/api/v1/users/gh-user/followers", + "following_url": "https://codeberg.org/api/v1/users/gh-user/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/gh-user/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/gh-user/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/gh-user/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/gh-user/orgs", + "repos_url": "https://codeberg.org/api/v1/users/gh-user/repos", + "events_url": "https://codeberg.org/api/v1/users/gh-user/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/gh-user/received_events", + "type": "User", + "site_admin": false + }, + "body": "Please review and merge", + "created_at": "2022-11-28T08:43:09Z", + "updated_at": "2022-11-28T10:11:53Z", + "closed_at": "2022-11-28T10:11:52Z", + "merged_at": "2022-11-28T10:11:52Z", + "merge_commit_sha": "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", + "assignee": null, + "assignees": [ + + ], + "requested_reviewers": [ + { + "login": "requested-gh-user", + "id": 1422582, + "node_id": "MDQ6VXNlcjE0MjI1ODI=", + "avatar_url": "https://avatars.codebergusercontent.com/u/1422582?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/requested-gh-user", + "html_url": "https://codeberg.org/requested-gh-user", + "followers_url": "https://codeberg.org/api/v1/users/requested-gh-user/followers", + "following_url": "https://codeberg.org/api/v1/users/requested-gh-user/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/requested-gh-user/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/requested-gh-user/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/requested-gh-user/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/requested-gh-user/orgs", + "repos_url": "https://codeberg.org/api/v1/users/requested-gh-user/repos", + "events_url": "https://codeberg.org/api/v1/users/requested-gh-user/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/requested-gh-user/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "gh-user", + "id": 1422582, + "node_id": "MDQ6VXNlcjE0MjI1ODI=", + "avatar_url": "https://avatars.codebergusercontent.com/u/1422582?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/gh-user", + "html_url": "https://codeberg.org/gh-user", + "followers_url": "https://codeberg.org/api/v1/users/gh-user/followers", + "following_url": "https://codeberg.org/api/v1/users/gh-user/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/gh-user/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/gh-user/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/gh-user/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/gh-user/orgs", + "repos_url": "https://codeberg.org/api/v1/users/gh-user/repos", + "events_url": "https://codeberg.org/api/v1/users/gh-user/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/gh-user/received_events", + "type": "User", + "site_admin": false + } + ], + "requested_teams": [ + + ], + "labels": [ + { + "id": 4901021057, + "node_id": "LA_kwDOImgs2354988AAAABJB-lgQ", + "url": "https://codeberg.org/api/v1/repos/owner/reponame/labels/backport-prod", + "name": "backport prod", + "color": "AB975B", + "default": false, + "description": "" + } + ], + "milestone": null, + "draft": false, + "commits_url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/2368/commits", + "review_comments_url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/2368/comments", + "review_comment_url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/comments{/number}", + "comments_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/2368/comments", + "statuses_url": "https://codeberg.org/api/v1/repos/owner/reponame/statuses/91748965051fae1330ad58d15cf694e103267c87", + "head": { + "label": "kiegroup:bump-8.31.x-drools-8.31.0.Final", + "ref": "bump-8.31.x-drools-8.31.0.Final", + "sha": "91748965051fae1330ad58d15cf694e103267c87", + "user": { + "login": "kiegroup", + "id": 517980, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjUxNzk4MA==", + "avatar_url": "https://avatars.codebergusercontent.com/u/517980?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/kiegroup", + "html_url": "https://codeberg.org/kiegroup", + "followers_url": "https://codeberg.org/api/v1/users/kiegroup/followers", + "following_url": "https://codeberg.org/api/v1/users/kiegroup/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/kiegroup/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/kiegroup/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/kiegroup/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/kiegroup/orgs", + "repos_url": "https://codeberg.org/api/v1/users/kiegroup/repos", + "events_url": "https://codeberg.org/api/v1/users/kiegroup/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/kiegroup/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 1370858, + "node_id": "MDEwOlJlcG9zaXRvcnkxMzcwODU4", + "name": "reponame", + "full_name": "fork/reponame", + "private": false, + "owner": { + "login": "kiegroup", + "id": 517980, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjUxNzk4MA==", + "avatar_url": "https://avatars.codebergusercontent.com/u/517980?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/kiegroup", + "html_url": "https://codeberg.org/kiegroup", + "followers_url": "https://codeberg.org/api/v1/users/kiegroup/followers", + "following_url": "https://codeberg.org/api/v1/users/kiegroup/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/kiegroup/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/kiegroup/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/kiegroup/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/kiegroup/orgs", + "repos_url": "https://codeberg.org/api/v1/users/kiegroup/repos", + "events_url": "https://codeberg.org/api/v1/users/kiegroup/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/kiegroup/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://codeberg.org/fork/reponame", + "description": "AI constraint solver in Java to optimize the vehicle routing problem, employee rostering, task assignment, maintenance scheduling, conference scheduling and other planning problems.", + "fork": false, + "url": "https://codeberg.org/api/v1/repos/fork/reponame", + "forks_url": "https://codeberg.org/api/v1/repos/fork/reponame/forks", + "keys_url": "https://codeberg.org/api/v1/repos/fork/reponame/keys{/key_id}", + "collaborators_url": "https://codeberg.org/api/v1/repos/fork/reponame/collaborators{/collaborator}", + "teams_url": "https://codeberg.org/api/v1/repos/fork/reponame/teams", + "hooks_url": "https://codeberg.org/api/v1/repos/fork/reponame/hooks", + "issue_events_url": "https://codeberg.org/api/v1/repos/fork/reponame/issues/events{/number}", + "events_url": "https://codeberg.org/api/v1/repos/fork/reponame/events", + "assignees_url": "https://codeberg.org/api/v1/repos/fork/reponame/assignees{/user}", + "branches_url": "https://codeberg.org/api/v1/repos/fork/reponame/branches{/branch}", + "tags_url": "https://codeberg.org/api/v1/repos/fork/reponame/tags", + "blobs_url": "https://codeberg.org/api/v1/repos/fork/reponame/git/blobs{/sha}", + "git_tags_url": "https://codeberg.org/api/v1/repos/fork/reponame/git/tags{/sha}", + "git_refs_url": "https://codeberg.org/api/v1/repos/fork/reponame/git/refs{/sha}", + "trees_url": "https://codeberg.org/api/v1/repos/fork/reponame/git/trees{/sha}", + "statuses_url": "https://codeberg.org/api/v1/repos/fork/reponame/statuses/{sha}", + "languages_url": "https://codeberg.org/api/v1/repos/fork/reponame/languages", + "stargazers_url": "https://codeberg.org/api/v1/repos/fork/reponame/stargazers", + "contributors_url": "https://codeberg.org/api/v1/repos/fork/reponame/contributors", + "subscribers_url": "https://codeberg.org/api/v1/repos/fork/reponame/subscribers", + "subscription_url": "https://codeberg.org/api/v1/repos/fork/reponame/subscription", + "commits_url": "https://codeberg.org/api/v1/repos/fork/reponame/commits{/sha}", + "git_commits_url": "https://codeberg.org/api/v1/repos/fork/reponame/git/commits{/sha}", + "comments_url": "https://codeberg.org/api/v1/repos/fork/reponame/comments{/number}", + "issue_comment_url": "https://codeberg.org/api/v1/repos/fork/reponame/issues/comments{/number}", + "contents_url": "https://codeberg.org/api/v1/repos/fork/reponame/contents/{+path}", + "compare_url": "https://codeberg.org/api/v1/repos/fork/reponame/compare/{base}...{head}", + "merges_url": "https://codeberg.org/api/v1/repos/fork/reponame/merges", + "archive_url": "https://codeberg.org/api/v1/repos/fork/reponame/{archive_format}{/ref}", + "downloads_url": "https://codeberg.org/api/v1/repos/fork/reponame/downloads", + "issues_url": "https://codeberg.org/api/v1/repos/fork/reponame/issues{/number}", + "pulls_url": "https://codeberg.org/api/v1/repos/fork/reponame/pulls{/number}", + "milestones_url": "https://codeberg.org/api/v1/repos/fork/reponame/milestones{/number}", + "notifications_url": "https://codeberg.org/api/v1/repos/fork/reponame/notifications{?since,all,participating}", + "labels_url": "https://codeberg.org/api/v1/repos/fork/reponame/labels{/name}", + "releases_url": "https://codeberg.org/api/v1/repos/fork/reponame/releases{/id}", + "deployments_url": "https://codeberg.org/api/v1/repos/fork/reponame/deployments", + "created_at": "2011-02-15T19:38:23Z", + "updated_at": "2022-11-28T05:01:47Z", + "pushed_at": "2022-11-28T10:50:51Z", + "git_url": "git://codeberg.org/fork/reponame.git", + "ssh_url": "git@codeberg.org:fork/reponame.git", + "clone_url": "https://codeberg.org/fork/reponame.git", + "svn_url": "https://codeberg.org/fork/reponame", + "homepage": "https://www.reponame.org", + "size": 238339, + "stargazers_count": 2811, + "watchers_count": 2811, + "language": "Java", + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 878, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 30, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://codeberg.org/api/v1/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "artificial-intelligence", + "branch-and-bound", + "constraint-programming", + "constraint-satisfaction-problem", + "constraint-solver", + "constraints", + "employee-rostering", + "java", + "local-search", + "mathematical-optimization", + "metaheuristics", + "optimization", + "rostering", + "scheduling", + "simulated-annealing", + "solver", + "tabu-search", + "traveling-salesman", + "traveling-salesman-problem", + "vehicle-routing-problem" + ], + "visibility": "public", + "forks": 878, + "open_issues": 30, + "watchers": 2811, + "default_branch": "main" + } + }, + "base": { + "label": "kiegroup:8.31.x", + "ref": "8.31.x", + "sha": "8cfc286765cb01c84a1d62c65519fa8032bfecbd", + "user": { + "login": "kiegroup", + "id": 517980, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjUxNzk4MA==", + "avatar_url": "https://avatars.codebergusercontent.com/u/517980?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/kiegroup", + "html_url": "https://codeberg.org/kiegroup", + "followers_url": "https://codeberg.org/api/v1/users/kiegroup/followers", + "following_url": "https://codeberg.org/api/v1/users/kiegroup/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/kiegroup/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/kiegroup/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/kiegroup/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/kiegroup/orgs", + "repos_url": "https://codeberg.org/api/v1/users/kiegroup/repos", + "events_url": "https://codeberg.org/api/v1/users/kiegroup/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/kiegroup/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 1370858, + "node_id": "MDEwOlJlcG9zaXRvcnkxMzcwODU4", + "name": "reponame", + "full_name": "owner/reponame", + "private": false, + "owner": { + "login": "kiegroup", + "id": 517980, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjUxNzk4MA==", + "avatar_url": "https://avatars.codebergusercontent.com/u/517980?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/kiegroup", + "html_url": "https://codeberg.org/kiegroup", + "followers_url": "https://codeberg.org/api/v1/users/kiegroup/followers", + "following_url": "https://codeberg.org/api/v1/users/kiegroup/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/kiegroup/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/kiegroup/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/kiegroup/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/kiegroup/orgs", + "repos_url": "https://codeberg.org/api/v1/users/kiegroup/repos", + "events_url": "https://codeberg.org/api/v1/users/kiegroup/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/kiegroup/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://codeberg.org/owner/reponame", + "description": "AI constraint solver in Java to optimize the vehicle routing problem, employee rostering, task assignment, maintenance scheduling, conference scheduling and other planning problems.", + "fork": false, + "url": "https://codeberg.org/api/v1/repos/owner/reponame", + "forks_url": "https://codeberg.org/api/v1/repos/owner/reponame/forks", + "keys_url": "https://codeberg.org/api/v1/repos/owner/reponame/keys{/key_id}", + "collaborators_url": "https://codeberg.org/api/v1/repos/owner/reponame/collaborators{/collaborator}", + "teams_url": "https://codeberg.org/api/v1/repos/owner/reponame/teams", + "hooks_url": "https://codeberg.org/api/v1/repos/owner/reponame/hooks", + "issue_events_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/events{/number}", + "events_url": "https://codeberg.org/api/v1/repos/owner/reponame/events", + "assignees_url": "https://codeberg.org/api/v1/repos/owner/reponame/assignees{/user}", + "branches_url": "https://codeberg.org/api/v1/repos/owner/reponame/branches{/branch}", + "tags_url": "https://codeberg.org/api/v1/repos/owner/reponame/tags", + "blobs_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/blobs{/sha}", + "git_tags_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/tags{/sha}", + "git_refs_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/refs{/sha}", + "trees_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/trees{/sha}", + "statuses_url": "https://codeberg.org/api/v1/repos/owner/reponame/statuses/{sha}", + "languages_url": "https://codeberg.org/api/v1/repos/owner/reponame/languages", + "stargazers_url": "https://codeberg.org/api/v1/repos/owner/reponame/stargazers", + "contributors_url": "https://codeberg.org/api/v1/repos/owner/reponame/contributors", + "subscribers_url": "https://codeberg.org/api/v1/repos/owner/reponame/subscribers", + "subscription_url": "https://codeberg.org/api/v1/repos/owner/reponame/subscription", + "commits_url": "https://codeberg.org/api/v1/repos/owner/reponame/commits{/sha}", + "git_commits_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/commits{/sha}", + "comments_url": "https://codeberg.org/api/v1/repos/owner/reponame/comments{/number}", + "issue_comment_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/comments{/number}", + "contents_url": "https://codeberg.org/api/v1/repos/owner/reponame/contents/{+path}", + "compare_url": "https://codeberg.org/api/v1/repos/owner/reponame/compare/{base}...{head}", + "merges_url": "https://codeberg.org/api/v1/repos/owner/reponame/merges", + "archive_url": "https://codeberg.org/api/v1/repos/owner/reponame/{archive_format}{/ref}", + "downloads_url": "https://codeberg.org/api/v1/repos/owner/reponame/downloads", + "issues_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues{/number}", + "pulls_url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls{/number}", + "milestones_url": "https://codeberg.org/api/v1/repos/owner/reponame/milestones{/number}", + "notifications_url": "https://codeberg.org/api/v1/repos/owner/reponame/notifications{?since,all,participating}", + "labels_url": "https://codeberg.org/api/v1/repos/owner/reponame/labels{/name}", + "releases_url": "https://codeberg.org/api/v1/repos/owner/reponame/releases{/id}", + "deployments_url": "https://codeberg.org/api/v1/repos/owner/reponame/deployments", + "created_at": "2011-02-15T19:38:23Z", + "updated_at": "2022-11-28T05:01:47Z", + "pushed_at": "2022-11-28T10:50:51Z", + "git_url": "git://codeberg.org/owner/reponame.git", + "ssh_url": "git@codeberg.org:owner/reponame.git", + "clone_url": "https://codeberg.org/owner/reponame.git", + "svn_url": "https://codeberg.org/owner/reponame", + "homepage": "https://www.reponame.org", + "size": 238339, + "stargazers_count": 2811, + "watchers_count": 2811, + "language": "Java", + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 878, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 30, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://codeberg.org/api/v1/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "artificial-intelligence", + "branch-and-bound", + "constraint-programming", + "constraint-satisfaction-problem", + "constraint-solver", + "constraints", + "employee-rostering", + "java", + "local-search", + "mathematical-optimization", + "metaheuristics", + "optimization", + "rostering", + "scheduling", + "simulated-annealing", + "solver", + "tabu-search", + "traveling-salesman", + "traveling-salesman-problem", + "vehicle-routing-problem" + ], + "visibility": "public", + "forks": 878, + "open_issues": 30, + "watchers": 2811, + "default_branch": "main" + } + }, + "_links": { + "self": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/2368" + }, + "html": { + "href": "https://codeberg.org/owner/reponame/pulls/2368" + }, + "issue": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/issues/2368" + }, + "comments": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/issues/2368/comments" + }, + "review_comments": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/2368/comments" + }, + "review_comment": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/comments{/number}" + }, + "commits": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/2368/commits" + }, + "statuses": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/statuses/91748965051fae1330ad58d15cf694e103267c87" + } + }, + "author_association": "CONTRIBUTOR", + "auto_merge": null, + "active_lock_reason": null, + "merged": true, + "mergeable": null, + "rebaseable": null, + "mergeable_state": "unknown", + "merged_by": { + "login": "that-s-a-user", + "id": 17157711, + "node_id": "MDQ6VXNlcjE3MTU3NzEx", + "avatar_url": "https://avatars.codebergusercontent.com/u/17157711?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/that-s-a-user", + "html_url": "https://codeberg.org/that-s-a-user", + "followers_url": "https://codeberg.org/api/v1/users/that-s-a-user/followers", + "following_url": "https://codeberg.org/api/v1/users/that-s-a-user/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/that-s-a-user/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/that-s-a-user/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/that-s-a-user/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/that-s-a-user/orgs", + "repos_url": "https://codeberg.org/api/v1/users/that-s-a-user/repos", + "events_url": "https://codeberg.org/api/v1/users/that-s-a-user/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/that-s-a-user/received_events", + "type": "User", + "site_admin": false + }, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 2, + "additions": 2, + "deletions": 2, + "changed_files": 2 +}; + +export const CB_OPEN_PR_FIXTURE = { + "url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/4444", + "id": 1137188271, + "node_id": "PR_kwDOABTq6s5DyB2v", + "html_url": "https://codeberg.org/owner/reponame/pulls/4444", + "diff_url": "https://codeberg.org/owner/reponame/pulls/4444.diff", + "patch_url": "https://codeberg.org/owner/reponame/pulls/4444.patch", + "issue_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/4444", + "number": 4444, + "state": "open", + "locked": false, + "title": "PR Title", + "user": { + "login": "gh-user", + "id": 11995863, + "node_id": "MDQ6VXNlcjExOTk1ODYz", + "avatar_url": "https://avatars.codebergusercontent.com/u/11995863?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/gh-user", + "html_url": "https://codeberg.org/gh-user", + "followers_url": "https://codeberg.org/api/v1/users/gh-user/followers", + "following_url": "https://codeberg.org/api/v1/users/gh-user/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/gh-user/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/gh-user/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/gh-user/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/gh-user/orgs", + "repos_url": "https://codeberg.org/api/v1/users/gh-user/repos", + "events_url": "https://codeberg.org/api/v1/users/gh-user/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/gh-user/received_events", + "type": "User", + "site_admin": false + }, + "body": "Please review and merge", + "created_at": "2022-11-28T08:43:09Z", + "updated_at": "2022-11-28T10:11:53Z", + "closed_at": "2022-11-28T10:11:52Z", + "merged_at": "2022-11-28T10:11:52Z", + "merge_commit_sha": "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", + "assignee": null, + "assignees": [ + + ], + "requested_reviewers": [ + { + "login": "gh-user", + "id": 1422582, + "node_id": "MDQ6VXNlcjE0MjI1ODI=", + "avatar_url": "https://avatars.codebergusercontent.com/u/1422582?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/gh-user", + "html_url": "https://codeberg.org/gh-user", + "followers_url": "https://codeberg.org/api/v1/users/gh-user/followers", + "following_url": "https://codeberg.org/api/v1/users/gh-user/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/gh-user/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/gh-user/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/gh-user/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/gh-user/orgs", + "repos_url": "https://codeberg.org/api/v1/users/gh-user/repos", + "events_url": "https://codeberg.org/api/v1/users/gh-user/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/gh-user/received_events", + "type": "User", + "site_admin": false + } + ], + "requested_teams": [ + + ], + "labels": [ + + ], + "milestone": null, + "draft": false, + "commits_url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/4444/commits", + "review_comments_url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/4444/comments", + "review_comment_url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/comments{/number}", + "comments_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/4444/comments", + "statuses_url": "https://codeberg.org/api/v1/repos/owner/reponame/statuses/91748965051fae1330ad58d15cf694e103267c87", + "head": { + "label": "kiegroup:bump-8.31.x-drools-8.31.0.Final", + "ref": "bump-8.31.x-drools-8.31.0.Final", + "sha": "91748965051fae1330ad58d15cf694e103267c87", + "user": { + "login": "kiegroup", + "id": 517980, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjUxNzk4MA==", + "avatar_url": "https://avatars.codebergusercontent.com/u/517980?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/kiegroup", + "html_url": "https://codeberg.org/kiegroup", + "followers_url": "https://codeberg.org/api/v1/users/kiegroup/followers", + "following_url": "https://codeberg.org/api/v1/users/kiegroup/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/kiegroup/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/kiegroup/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/kiegroup/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/kiegroup/orgs", + "repos_url": "https://codeberg.org/api/v1/users/kiegroup/repos", + "events_url": "https://codeberg.org/api/v1/users/kiegroup/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/kiegroup/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 1370858, + "node_id": "MDEwOlJlcG9zaXRvcnkxMzcwODU4", + "name": "reponame", + "full_name": "fork/reponame", + "private": false, + "owner": { + "login": "kiegroup", + "id": 517980, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjUxNzk4MA==", + "avatar_url": "https://avatars.codebergusercontent.com/u/517980?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/kiegroup", + "html_url": "https://codeberg.org/kiegroup", + "followers_url": "https://codeberg.org/api/v1/users/kiegroup/followers", + "following_url": "https://codeberg.org/api/v1/users/kiegroup/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/kiegroup/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/kiegroup/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/kiegroup/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/kiegroup/orgs", + "repos_url": "https://codeberg.org/api/v1/users/kiegroup/repos", + "events_url": "https://codeberg.org/api/v1/users/kiegroup/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/kiegroup/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://codeberg.org/fork/reponame", + "description": "AI constraint solver in Java to optimize the vehicle routing problem, employee rostering, task assignment, maintenance scheduling, conference scheduling and other planning problems.", + "fork": false, + "url": "https://codeberg.org/api/v1/repos/fork/reponame", + "forks_url": "https://codeberg.org/api/v1/repos/fork/reponame/forks", + "keys_url": "https://codeberg.org/api/v1/repos/fork/reponame/keys{/key_id}", + "collaborators_url": "https://codeberg.org/api/v1/repos/fork/reponame/collaborators{/collaborator}", + "teams_url": "https://codeberg.org/api/v1/repos/fork/reponame/teams", + "hooks_url": "https://codeberg.org/api/v1/repos/fork/reponame/hooks", + "issue_events_url": "https://codeberg.org/api/v1/repos/fork/reponame/issues/events{/number}", + "events_url": "https://codeberg.org/api/v1/repos/fork/reponame/events", + "assignees_url": "https://codeberg.org/api/v1/repos/fork/reponame/assignees{/user}", + "branches_url": "https://codeberg.org/api/v1/repos/fork/reponame/branches{/branch}", + "tags_url": "https://codeberg.org/api/v1/repos/fork/reponame/tags", + "blobs_url": "https://codeberg.org/api/v1/repos/fork/reponame/git/blobs{/sha}", + "git_tags_url": "https://codeberg.org/api/v1/repos/fork/reponame/git/tags{/sha}", + "git_refs_url": "https://codeberg.org/api/v1/repos/fork/reponame/git/refs{/sha}", + "trees_url": "https://codeberg.org/api/v1/repos/fork/reponame/git/trees{/sha}", + "statuses_url": "https://codeberg.org/api/v1/repos/fork/reponame/statuses/{sha}", + "languages_url": "https://codeberg.org/api/v1/repos/fork/reponame/languages", + "stargazers_url": "https://codeberg.org/api/v1/repos/fork/reponame/stargazers", + "contributors_url": "https://codeberg.org/api/v1/repos/fork/reponame/contributors", + "subscribers_url": "https://codeberg.org/api/v1/repos/fork/reponame/subscribers", + "subscription_url": "https://codeberg.org/api/v1/repos/fork/reponame/subscription", + "commits_url": "https://codeberg.org/api/v1/repos/fork/reponame/commits{/sha}", + "git_commits_url": "https://codeberg.org/api/v1/repos/fork/reponame/git/commits{/sha}", + "comments_url": "https://codeberg.org/api/v1/repos/fork/reponame/comments{/number}", + "issue_comment_url": "https://codeberg.org/api/v1/repos/fork/reponame/issues/comments{/number}", + "contents_url": "https://codeberg.org/api/v1/repos/fork/reponame/contents/{+path}", + "compare_url": "https://codeberg.org/api/v1/repos/fork/reponame/compare/{base}...{head}", + "merges_url": "https://codeberg.org/api/v1/repos/fork/reponame/merges", + "archive_url": "https://codeberg.org/api/v1/repos/fork/reponame/{archive_format}{/ref}", + "downloads_url": "https://codeberg.org/api/v1/repos/fork/reponame/downloads", + "issues_url": "https://codeberg.org/api/v1/repos/fork/reponame/issues{/number}", + "pulls_url": "https://codeberg.org/api/v1/repos/fork/reponame/pulls{/number}", + "milestones_url": "https://codeberg.org/api/v1/repos/fork/reponame/milestones{/number}", + "notifications_url": "https://codeberg.org/api/v1/repos/fork/reponame/notifications{?since,all,participating}", + "labels_url": "https://codeberg.org/api/v1/repos/fork/reponame/labels{/name}", + "releases_url": "https://codeberg.org/api/v1/repos/fork/reponame/releases{/id}", + "deployments_url": "https://codeberg.org/api/v1/repos/fork/reponame/deployments", + "created_at": "2011-02-15T19:38:23Z", + "updated_at": "2022-11-28T05:01:47Z", + "pushed_at": "2022-11-28T10:50:51Z", + "git_url": "git://codeberg.org/fork/reponame.git", + "ssh_url": "git@codeberg.org:fork/reponame.git", + "clone_url": "https://codeberg.org/fork/reponame.git", + "svn_url": "https://codeberg.org/fork/reponame", + "homepage": "https://www.reponame.org", + "size": 238339, + "stargazers_count": 2811, + "watchers_count": 2811, + "language": "Java", + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 878, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 30, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://codeberg.org/api/v1/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "artificial-intelligence", + "branch-and-bound", + "constraint-programming", + "constraint-satisfaction-problem", + "constraint-solver", + "constraints", + "employee-rostering", + "java", + "local-search", + "mathematical-optimization", + "metaheuristics", + "optimization", + "rostering", + "scheduling", + "simulated-annealing", + "solver", + "tabu-search", + "traveling-salesman", + "traveling-salesman-problem", + "vehicle-routing-problem" + ], + "visibility": "public", + "forks": 878, + "open_issues": 30, + "watchers": 2811, + "default_branch": "main" + } + }, + "base": { + "label": "kiegroup:8.31.x", + "ref": "8.31.x", + "sha": "8cfc286765cb01c84a1d62c65519fa8032bfecbd", + "user": { + "login": "kiegroup", + "id": 517980, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjUxNzk4MA==", + "avatar_url": "https://avatars.codebergusercontent.com/u/517980?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/kiegroup", + "html_url": "https://codeberg.org/kiegroup", + "followers_url": "https://codeberg.org/api/v1/users/kiegroup/followers", + "following_url": "https://codeberg.org/api/v1/users/kiegroup/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/kiegroup/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/kiegroup/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/kiegroup/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/kiegroup/orgs", + "repos_url": "https://codeberg.org/api/v1/users/kiegroup/repos", + "events_url": "https://codeberg.org/api/v1/users/kiegroup/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/kiegroup/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 1370858, + "node_id": "MDEwOlJlcG9zaXRvcnkxMzcwODU4", + "name": "reponame", + "full_name": "owner/reponame", + "private": false, + "owner": { + "login": "kiegroup", + "id": 517980, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjUxNzk4MA==", + "avatar_url": "https://avatars.codebergusercontent.com/u/517980?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/kiegroup", + "html_url": "https://codeberg.org/kiegroup", + "followers_url": "https://codeberg.org/api/v1/users/kiegroup/followers", + "following_url": "https://codeberg.org/api/v1/users/kiegroup/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/kiegroup/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/kiegroup/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/kiegroup/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/kiegroup/orgs", + "repos_url": "https://codeberg.org/api/v1/users/kiegroup/repos", + "events_url": "https://codeberg.org/api/v1/users/kiegroup/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/kiegroup/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://codeberg.org/owner/reponame", + "description": "AI constraint solver in Java to optimize the vehicle routing problem, employee rostering, task assignment, maintenance scheduling, conference scheduling and other planning problems.", + "fork": false, + "url": "https://codeberg.org/api/v1/repos/owner/reponame", + "forks_url": "https://codeberg.org/api/v1/repos/owner/reponame/forks", + "keys_url": "https://codeberg.org/api/v1/repos/owner/reponame/keys{/key_id}", + "collaborators_url": "https://codeberg.org/api/v1/repos/owner/reponame/collaborators{/collaborator}", + "teams_url": "https://codeberg.org/api/v1/repos/owner/reponame/teams", + "hooks_url": "https://codeberg.org/api/v1/repos/owner/reponame/hooks", + "issue_events_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/events{/number}", + "events_url": "https://codeberg.org/api/v1/repos/owner/reponame/events", + "assignees_url": "https://codeberg.org/api/v1/repos/owner/reponame/assignees{/user}", + "branches_url": "https://codeberg.org/api/v1/repos/owner/reponame/branches{/branch}", + "tags_url": "https://codeberg.org/api/v1/repos/owner/reponame/tags", + "blobs_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/blobs{/sha}", + "git_tags_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/tags{/sha}", + "git_refs_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/refs{/sha}", + "trees_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/trees{/sha}", + "statuses_url": "https://codeberg.org/api/v1/repos/owner/reponame/statuses/{sha}", + "languages_url": "https://codeberg.org/api/v1/repos/owner/reponame/languages", + "stargazers_url": "https://codeberg.org/api/v1/repos/owner/reponame/stargazers", + "contributors_url": "https://codeberg.org/api/v1/repos/owner/reponame/contributors", + "subscribers_url": "https://codeberg.org/api/v1/repos/owner/reponame/subscribers", + "subscription_url": "https://codeberg.org/api/v1/repos/owner/reponame/subscription", + "commits_url": "https://codeberg.org/api/v1/repos/owner/reponame/commits{/sha}", + "git_commits_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/commits{/sha}", + "comments_url": "https://codeberg.org/api/v1/repos/owner/reponame/comments{/number}", + "issue_comment_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/comments{/number}", + "contents_url": "https://codeberg.org/api/v1/repos/owner/reponame/contents/{+path}", + "compare_url": "https://codeberg.org/api/v1/repos/owner/reponame/compare/{base}...{head}", + "merges_url": "https://codeberg.org/api/v1/repos/owner/reponame/merges", + "archive_url": "https://codeberg.org/api/v1/repos/owner/reponame/{archive_format}{/ref}", + "downloads_url": "https://codeberg.org/api/v1/repos/owner/reponame/downloads", + "issues_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues{/number}", + "pulls_url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls{/number}", + "milestones_url": "https://codeberg.org/api/v1/repos/owner/reponame/milestones{/number}", + "notifications_url": "https://codeberg.org/api/v1/repos/owner/reponame/notifications{?since,all,participating}", + "labels_url": "https://codeberg.org/api/v1/repos/owner/reponame/labels{/name}", + "releases_url": "https://codeberg.org/api/v1/repos/owner/reponame/releases{/id}", + "deployments_url": "https://codeberg.org/api/v1/repos/owner/reponame/deployments", + "created_at": "2011-02-15T19:38:23Z", + "updated_at": "2022-11-28T05:01:47Z", + "pushed_at": "2022-11-28T10:50:51Z", + "git_url": "git://codeberg.org/owner/reponame.git", + "ssh_url": "git@codeberg.org:owner/reponame.git", + "clone_url": "https://codeberg.org/owner/reponame.git", + "svn_url": "https://codeberg.org/owner/reponame", + "homepage": "https://www.reponame.org", + "size": 238339, + "stargazers_count": 2811, + "watchers_count": 2811, + "language": "Java", + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 878, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 30, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://codeberg.org/api/v1/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "artificial-intelligence", + "branch-and-bound", + "constraint-programming", + "constraint-satisfaction-problem", + "constraint-solver", + "constraints", + "employee-rostering", + "java", + "local-search", + "mathematical-optimization", + "metaheuristics", + "optimization", + "rostering", + "scheduling", + "simulated-annealing", + "solver", + "tabu-search", + "traveling-salesman", + "traveling-salesman-problem", + "vehicle-routing-problem" + ], + "visibility": "public", + "forks": 878, + "open_issues": 30, + "watchers": 2811, + "default_branch": "main" + } + }, + "_links": { + "self": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/4444" + }, + "html": { + "href": "https://codeberg.org/owner/reponame/pulls/4444" + }, + "issue": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/issues/4444" + }, + "comments": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/issues/4444/comments" + }, + "review_comments": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/4444/comments" + }, + "review_comment": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/comments{/number}" + }, + "commits": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/4444/commits" + }, + "statuses": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/statuses/91748965051fae1330ad58d15cf694e103267c87" + } + }, + "author_association": "CONTRIBUTOR", + "auto_merge": null, + "active_lock_reason": null, + "merged": null, + "mergeable": null, + "rebaseable": null, + "mergeable_state": "unknown", + "merged_by": {}, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 2, + "additions": 2, + "deletions": 2, + "changed_files": 2 +}; + +export const CB_NOT_MERGED_PR_FIXTURE = { + "url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/6666", + "id": 1137188271, + "node_id": "PR_kwDOABTq6s5DyB2v", + "html_url": "https://codeberg.org/owner/reponame/pulls/6666", + "diff_url": "https://codeberg.org/owner/reponame/pulls/6666.diff", + "patch_url": "https://codeberg.org/owner/reponame/pulls/6666.patch", + "issue_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/6666", + "number": 6666, + "state": "closed", + "locked": false, + "title": "PR Title", + "user": { + "login": "gh-user", + "id": 11995863, + "node_id": "MDQ6VXNlcjExOTk1ODYz", + "avatar_url": "https://avatars.codebergusercontent.com/u/11995863?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/gh-user", + "html_url": "https://codeberg.org/gh-user", + "followers_url": "https://codeberg.org/api/v1/users/gh-user/followers", + "following_url": "https://codeberg.org/api/v1/users/gh-user/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/gh-user/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/gh-user/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/gh-user/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/gh-user/orgs", + "repos_url": "https://codeberg.org/api/v1/users/gh-user/repos", + "events_url": "https://codeberg.org/api/v1/users/gh-user/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/gh-user/received_events", + "type": "User", + "site_admin": false + }, + "body": "Please review and merge", + "created_at": "2022-11-28T08:43:09Z", + "updated_at": "2022-11-28T10:11:53Z", + "closed_at": "2022-11-28T10:11:52Z", + "merged_at": "2022-11-28T10:11:52Z", + "merge_commit_sha": "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", + "assignee": null, + "assignees": [ + + ], + "requested_reviewers": [ + { + "login": "gh-user", + "id": 1422582, + "node_id": "MDQ6VXNlcjE0MjI1ODI=", + "avatar_url": "https://avatars.codebergusercontent.com/u/1422582?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/gh-user", + "html_url": "https://codeberg.org/gh-user", + "followers_url": "https://codeberg.org/api/v1/users/gh-user/followers", + "following_url": "https://codeberg.org/api/v1/users/gh-user/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/gh-user/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/gh-user/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/gh-user/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/gh-user/orgs", + "repos_url": "https://codeberg.org/api/v1/users/gh-user/repos", + "events_url": "https://codeberg.org/api/v1/users/gh-user/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/gh-user/received_events", + "type": "User", + "site_admin": false + } + ], + "requested_teams": [ + + ], + "labels": [ + + ], + "milestone": null, + "draft": false, + "commits_url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/6666/commits", + "review_comments_url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/6666/comments", + "review_comment_url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/comments{/number}", + "comments_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/6666/comments", + "statuses_url": "https://codeberg.org/api/v1/repos/owner/reponame/statuses/91748965051fae1330ad58d15cf694e103267c87", + "head": { + "label": "kiegroup:bump-8.31.x-drools-8.31.0.Final", + "ref": "bump-8.31.x-drools-8.31.0.Final", + "sha": "91748965051fae1330ad58d15cf694e103267c87", + "user": { + "login": "kiegroup", + "id": 517980, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjUxNzk4MA==", + "avatar_url": "https://avatars.codebergusercontent.com/u/517980?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/kiegroup", + "html_url": "https://codeberg.org/kiegroup", + "followers_url": "https://codeberg.org/api/v1/users/kiegroup/followers", + "following_url": "https://codeberg.org/api/v1/users/kiegroup/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/kiegroup/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/kiegroup/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/kiegroup/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/kiegroup/orgs", + "repos_url": "https://codeberg.org/api/v1/users/kiegroup/repos", + "events_url": "https://codeberg.org/api/v1/users/kiegroup/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/kiegroup/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 1370858, + "node_id": "MDEwOlJlcG9zaXRvcnkxMzcwODU4", + "name": "reponame", + "full_name": "fork/reponame", + "private": false, + "owner": { + "login": "kiegroup", + "id": 517980, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjUxNzk4MA==", + "avatar_url": "https://avatars.codebergusercontent.com/u/517980?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/kiegroup", + "html_url": "https://codeberg.org/kiegroup", + "followers_url": "https://codeberg.org/api/v1/users/kiegroup/followers", + "following_url": "https://codeberg.org/api/v1/users/kiegroup/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/kiegroup/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/kiegroup/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/kiegroup/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/kiegroup/orgs", + "repos_url": "https://codeberg.org/api/v1/users/kiegroup/repos", + "events_url": "https://codeberg.org/api/v1/users/kiegroup/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/kiegroup/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://codeberg.org/fork/reponame", + "description": "AI constraint solver in Java to optimize the vehicle routing problem, employee rostering, task assignment, maintenance scheduling, conference scheduling and other planning problems.", + "fork": false, + "url": "https://codeberg.org/api/v1/repos/fork/reponame", + "forks_url": "https://codeberg.org/api/v1/repos/fork/reponame/forks", + "keys_url": "https://codeberg.org/api/v1/repos/fork/reponame/keys{/key_id}", + "collaborators_url": "https://codeberg.org/api/v1/repos/fork/reponame/collaborators{/collaborator}", + "teams_url": "https://codeberg.org/api/v1/repos/fork/reponame/teams", + "hooks_url": "https://codeberg.org/api/v1/repos/fork/reponame/hooks", + "issue_events_url": "https://codeberg.org/api/v1/repos/fork/reponame/issues/events{/number}", + "events_url": "https://codeberg.org/api/v1/repos/fork/reponame/events", + "assignees_url": "https://codeberg.org/api/v1/repos/fork/reponame/assignees{/user}", + "branches_url": "https://codeberg.org/api/v1/repos/fork/reponame/branches{/branch}", + "tags_url": "https://codeberg.org/api/v1/repos/fork/reponame/tags", + "blobs_url": "https://codeberg.org/api/v1/repos/fork/reponame/git/blobs{/sha}", + "git_tags_url": "https://codeberg.org/api/v1/repos/fork/reponame/git/tags{/sha}", + "git_refs_url": "https://codeberg.org/api/v1/repos/fork/reponame/git/refs{/sha}", + "trees_url": "https://codeberg.org/api/v1/repos/fork/reponame/git/trees{/sha}", + "statuses_url": "https://codeberg.org/api/v1/repos/fork/reponame/statuses/{sha}", + "languages_url": "https://codeberg.org/api/v1/repos/fork/reponame/languages", + "stargazers_url": "https://codeberg.org/api/v1/repos/fork/reponame/stargazers", + "contributors_url": "https://codeberg.org/api/v1/repos/fork/reponame/contributors", + "subscribers_url": "https://codeberg.org/api/v1/repos/fork/reponame/subscribers", + "subscription_url": "https://codeberg.org/api/v1/repos/fork/reponame/subscription", + "commits_url": "https://codeberg.org/api/v1/repos/fork/reponame/commits{/sha}", + "git_commits_url": "https://codeberg.org/api/v1/repos/fork/reponame/git/commits{/sha}", + "comments_url": "https://codeberg.org/api/v1/repos/fork/reponame/comments{/number}", + "issue_comment_url": "https://codeberg.org/api/v1/repos/fork/reponame/issues/comments{/number}", + "contents_url": "https://codeberg.org/api/v1/repos/fork/reponame/contents/{+path}", + "compare_url": "https://codeberg.org/api/v1/repos/fork/reponame/compare/{base}...{head}", + "merges_url": "https://codeberg.org/api/v1/repos/fork/reponame/merges", + "archive_url": "https://codeberg.org/api/v1/repos/fork/reponame/{archive_format}{/ref}", + "downloads_url": "https://codeberg.org/api/v1/repos/fork/reponame/downloads", + "issues_url": "https://codeberg.org/api/v1/repos/fork/reponame/issues{/number}", + "pulls_url": "https://codeberg.org/api/v1/repos/fork/reponame/pulls{/number}", + "milestones_url": "https://codeberg.org/api/v1/repos/fork/reponame/milestones{/number}", + "notifications_url": "https://codeberg.org/api/v1/repos/fork/reponame/notifications{?since,all,participating}", + "labels_url": "https://codeberg.org/api/v1/repos/fork/reponame/labels{/name}", + "releases_url": "https://codeberg.org/api/v1/repos/fork/reponame/releases{/id}", + "deployments_url": "https://codeberg.org/api/v1/repos/fork/reponame/deployments", + "created_at": "2011-02-15T19:38:23Z", + "updated_at": "2022-11-28T05:01:47Z", + "pushed_at": "2022-11-28T10:50:51Z", + "git_url": "git://codeberg.org/fork/reponame.git", + "ssh_url": "git@codeberg.org:fork/reponame.git", + "clone_url": "https://codeberg.org/fork/reponame.git", + "svn_url": "https://codeberg.org/fork/reponame", + "homepage": "https://www.reponame.org", + "size": 238339, + "stargazers_count": 2811, + "watchers_count": 2811, + "language": "Java", + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 878, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 30, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://codeberg.org/api/v1/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "artificial-intelligence", + "branch-and-bound", + "constraint-programming", + "constraint-satisfaction-problem", + "constraint-solver", + "constraints", + "employee-rostering", + "java", + "local-search", + "mathematical-optimization", + "metaheuristics", + "optimization", + "rostering", + "scheduling", + "simulated-annealing", + "solver", + "tabu-search", + "traveling-salesman", + "traveling-salesman-problem", + "vehicle-routing-problem" + ], + "visibility": "public", + "forks": 878, + "open_issues": 30, + "watchers": 2811, + "default_branch": "main" + } + }, + "base": { + "label": "kiegroup:8.31.x", + "ref": "8.31.x", + "sha": "8cfc286765cb01c84a1d62c65519fa8032bfecbd", + "user": { + "login": "kiegroup", + "id": 517980, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjUxNzk4MA==", + "avatar_url": "https://avatars.codebergusercontent.com/u/517980?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/kiegroup", + "html_url": "https://codeberg.org/kiegroup", + "followers_url": "https://codeberg.org/api/v1/users/kiegroup/followers", + "following_url": "https://codeberg.org/api/v1/users/kiegroup/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/kiegroup/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/kiegroup/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/kiegroup/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/kiegroup/orgs", + "repos_url": "https://codeberg.org/api/v1/users/kiegroup/repos", + "events_url": "https://codeberg.org/api/v1/users/kiegroup/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/kiegroup/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 1370858, + "node_id": "MDEwOlJlcG9zaXRvcnkxMzcwODU4", + "name": "reponame", + "full_name": "owner/reponame", + "private": false, + "owner": { + "login": "kiegroup", + "id": 517980, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjUxNzk4MA==", + "avatar_url": "https://avatars.codebergusercontent.com/u/517980?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/kiegroup", + "html_url": "https://codeberg.org/kiegroup", + "followers_url": "https://codeberg.org/api/v1/users/kiegroup/followers", + "following_url": "https://codeberg.org/api/v1/users/kiegroup/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/kiegroup/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/kiegroup/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/kiegroup/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/kiegroup/orgs", + "repos_url": "https://codeberg.org/api/v1/users/kiegroup/repos", + "events_url": "https://codeberg.org/api/v1/users/kiegroup/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/kiegroup/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://codeberg.org/owner/reponame", + "description": "AI constraint solver in Java to optimize the vehicle routing problem, employee rostering, task assignment, maintenance scheduling, conference scheduling and other planning problems.", + "fork": false, + "url": "https://codeberg.org/api/v1/repos/owner/reponame", + "forks_url": "https://codeberg.org/api/v1/repos/owner/reponame/forks", + "keys_url": "https://codeberg.org/api/v1/repos/owner/reponame/keys{/key_id}", + "collaborators_url": "https://codeberg.org/api/v1/repos/owner/reponame/collaborators{/collaborator}", + "teams_url": "https://codeberg.org/api/v1/repos/owner/reponame/teams", + "hooks_url": "https://codeberg.org/api/v1/repos/owner/reponame/hooks", + "issue_events_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/events{/number}", + "events_url": "https://codeberg.org/api/v1/repos/owner/reponame/events", + "assignees_url": "https://codeberg.org/api/v1/repos/owner/reponame/assignees{/user}", + "branches_url": "https://codeberg.org/api/v1/repos/owner/reponame/branches{/branch}", + "tags_url": "https://codeberg.org/api/v1/repos/owner/reponame/tags", + "blobs_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/blobs{/sha}", + "git_tags_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/tags{/sha}", + "git_refs_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/refs{/sha}", + "trees_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/trees{/sha}", + "statuses_url": "https://codeberg.org/api/v1/repos/owner/reponame/statuses/{sha}", + "languages_url": "https://codeberg.org/api/v1/repos/owner/reponame/languages", + "stargazers_url": "https://codeberg.org/api/v1/repos/owner/reponame/stargazers", + "contributors_url": "https://codeberg.org/api/v1/repos/owner/reponame/contributors", + "subscribers_url": "https://codeberg.org/api/v1/repos/owner/reponame/subscribers", + "subscription_url": "https://codeberg.org/api/v1/repos/owner/reponame/subscription", + "commits_url": "https://codeberg.org/api/v1/repos/owner/reponame/commits{/sha}", + "git_commits_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/commits{/sha}", + "comments_url": "https://codeberg.org/api/v1/repos/owner/reponame/comments{/number}", + "issue_comment_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/comments{/number}", + "contents_url": "https://codeberg.org/api/v1/repos/owner/reponame/contents/{+path}", + "compare_url": "https://codeberg.org/api/v1/repos/owner/reponame/compare/{base}...{head}", + "merges_url": "https://codeberg.org/api/v1/repos/owner/reponame/merges", + "archive_url": "https://codeberg.org/api/v1/repos/owner/reponame/{archive_format}{/ref}", + "downloads_url": "https://codeberg.org/api/v1/repos/owner/reponame/downloads", + "issues_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues{/number}", + "pulls_url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls{/number}", + "milestones_url": "https://codeberg.org/api/v1/repos/owner/reponame/milestones{/number}", + "notifications_url": "https://codeberg.org/api/v1/repos/owner/reponame/notifications{?since,all,participating}", + "labels_url": "https://codeberg.org/api/v1/repos/owner/reponame/labels{/name}", + "releases_url": "https://codeberg.org/api/v1/repos/owner/reponame/releases{/id}", + "deployments_url": "https://codeberg.org/api/v1/repos/owner/reponame/deployments", + "created_at": "2011-02-15T19:38:23Z", + "updated_at": "2022-11-28T05:01:47Z", + "pushed_at": "2022-11-28T10:50:51Z", + "git_url": "git://codeberg.org/owner/reponame.git", + "ssh_url": "git@codeberg.org:owner/reponame.git", + "clone_url": "https://codeberg.org/owner/reponame.git", + "svn_url": "https://codeberg.org/owner/reponame", + "homepage": "https://www.reponame.org", + "size": 238339, + "stargazers_count": 2811, + "watchers_count": 2811, + "language": "Java", + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 878, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 30, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://codeberg.org/api/v1/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "artificial-intelligence", + "branch-and-bound", + "constraint-programming", + "constraint-satisfaction-problem", + "constraint-solver", + "constraints", + "employee-rostering", + "java", + "local-search", + "mathematical-optimization", + "metaheuristics", + "optimization", + "rostering", + "scheduling", + "simulated-annealing", + "solver", + "tabu-search", + "traveling-salesman", + "traveling-salesman-problem", + "vehicle-routing-problem" + ], + "visibility": "public", + "forks": 878, + "open_issues": 30, + "watchers": 2811, + "default_branch": "main" + } + }, + "_links": { + "self": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/6666" + }, + "html": { + "href": "https://codeberg.org/owner/reponame/pulls/6666" + }, + "issue": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/issues/6666" + }, + "comments": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/issues/6666/comments" + }, + "review_comments": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/6666/comments" + }, + "review_comment": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/comments{/number}" + }, + "commits": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/6666/commits" + }, + "statuses": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/statuses/91748965051fae1330ad58d15cf694e103267c87" + } + }, + "author_association": "CONTRIBUTOR", + "auto_merge": null, + "active_lock_reason": null, + "merged": null, + "mergeable": null, + "rebaseable": null, + "mergeable_state": "unknown", + "merged_by": { + "login": "that-s-a-user", + "id": 17157711, + "node_id": "MDQ6VXNlcjE3MTU3NzEx", + "avatar_url": "https://avatars.codebergusercontent.com/u/17157711?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/that-s-a-user", + "html_url": "https://codeberg.org/that-s-a-user", + "followers_url": "https://codeberg.org/api/v1/users/that-s-a-user/followers", + "following_url": "https://codeberg.org/api/v1/users/that-s-a-user/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/that-s-a-user/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/that-s-a-user/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/that-s-a-user/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/that-s-a-user/orgs", + "repos_url": "https://codeberg.org/api/v1/users/that-s-a-user/repos", + "events_url": "https://codeberg.org/api/v1/users/that-s-a-user/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/that-s-a-user/received_events", + "type": "User", + "site_admin": false + }, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 2, + "additions": 2, + "deletions": 2, + "changed_files": 2 +}; + +export const CB_MULT_COMMITS_PR_FIXTURE = { + "url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/8632", + "id": 1137188271, + "node_id": "PR_kwDOABTq6s5DyB2v", + "html_url": "https://codeberg.org/owner/reponame/pulls/8632", + "diff_url": "https://codeberg.org/owner/reponame/pulls/8632.diff", + "patch_url": "https://codeberg.org/owner/reponame/pulls/8632.patch", + "issue_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/8632", + "number": 8632, + "state": "closed", + "locked": false, + "title": "PR Title", + "user": { + "login": "gh-user", + "id": 11995863, + "node_id": "MDQ6VXNlcjExOTk1ODYz", + "avatar_url": "https://avatars.codebergusercontent.com/u/11995863?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/gh-user", + "html_url": "https://codeberg.org/gh-user", + "followers_url": "https://codeberg.org/api/v1/users/gh-user/followers", + "following_url": "https://codeberg.org/api/v1/users/gh-user/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/gh-user/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/gh-user/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/gh-user/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/gh-user/orgs", + "repos_url": "https://codeberg.org/api/v1/users/gh-user/repos", + "events_url": "https://codeberg.org/api/v1/users/gh-user/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/gh-user/received_events", + "type": "User", + "site_admin": false + }, + "body": "Please review and merge", + "created_at": "2022-11-28T08:43:09Z", + "updated_at": "2022-11-28T10:11:53Z", + "closed_at": "2022-11-28T10:11:52Z", + "merged_at": "2022-11-28T10:11:52Z", + "merge_commit_sha": "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", + "assignee": null, + "assignees": [ + + ], + "requested_reviewers": [ + { + "login": "requested-gh-user", + "id": 1422582, + "node_id": "MDQ6VXNlcjE0MjI1ODI=", + "avatar_url": "https://avatars.codebergusercontent.com/u/1422582?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/requested-gh-user", + "html_url": "https://codeberg.org/requested-gh-user", + "followers_url": "https://codeberg.org/api/v1/users/requested-gh-user/followers", + "following_url": "https://codeberg.org/api/v1/users/requested-gh-user/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/requested-gh-user/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/requested-gh-user/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/requested-gh-user/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/requested-gh-user/orgs", + "repos_url": "https://codeberg.org/api/v1/users/requested-gh-user/repos", + "events_url": "https://codeberg.org/api/v1/users/requested-gh-user/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/requested-gh-user/received_events", + "type": "User", + "site_admin": false + }, + { + "login": "gh-user", + "id": 1422582, + "node_id": "MDQ6VXNlcjE0MjI1ODI=", + "avatar_url": "https://avatars.codebergusercontent.com/u/1422582?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/gh-user", + "html_url": "https://codeberg.org/gh-user", + "followers_url": "https://codeberg.org/api/v1/users/gh-user/followers", + "following_url": "https://codeberg.org/api/v1/users/gh-user/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/gh-user/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/gh-user/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/gh-user/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/gh-user/orgs", + "repos_url": "https://codeberg.org/api/v1/users/gh-user/repos", + "events_url": "https://codeberg.org/api/v1/users/gh-user/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/gh-user/received_events", + "type": "User", + "site_admin": false + } + ], + "requested_teams": [ + + ], + "labels": [ + { + "id": 4901021057, + "node_id": "LA_kwDOImgs2354988AAAABJB-lgQ", + "url": "https://codeberg.org/api/v1/repos/owner/reponame/labels/backport-v1", + "name": "backport v1", + "color": "AB975B", + "default": false, + "description": "" + }, + { + "id": 4901021057, + "node_id": "LA_kwDOImgs2354988AAAABJB-lgQ", + "url": "https://codeberg.org/api/v1/repos/owner/reponame/labels/backport-v2", + "name": "backport v2", + "color": "AB975B", + "default": false, + "description": "" + }, + { + "id": 4901021057, + "node_id": "LA_kwDOImgs2354988AAAABJB-lgQ", + "url": "https://codeberg.org/api/v1/repos/owner/reponame/labels/backport-v3", + "name": "backport v3", + "color": "AB975B", + "default": false, + "description": "" + } + ], + "milestone": null, + "draft": false, + "commits_url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/8632/commits", + "review_comments_url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/8632/comments", + "review_comment_url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/comments{/number}", + "comments_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/8632/comments", + "statuses_url": "https://codeberg.org/api/v1/repos/owner/reponame/statuses/91748965051fae1330ad58d15cf694e103267c87", + "head": { + "label": "kiegroup:bump-8.31.x-drools-8.31.0.Final", + "ref": "bump-8.31.x-drools-8.31.0.Final", + "sha": "91748965051fae1330ad58d15cf694e103267c87", + "user": { + "login": "kiegroup", + "id": 517980, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjUxNzk4MA==", + "avatar_url": "https://avatars.codebergusercontent.com/u/517980?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/kiegroup", + "html_url": "https://codeberg.org/kiegroup", + "followers_url": "https://codeberg.org/api/v1/users/kiegroup/followers", + "following_url": "https://codeberg.org/api/v1/users/kiegroup/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/kiegroup/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/kiegroup/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/kiegroup/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/kiegroup/orgs", + "repos_url": "https://codeberg.org/api/v1/users/kiegroup/repos", + "events_url": "https://codeberg.org/api/v1/users/kiegroup/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/kiegroup/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 1370858, + "node_id": "MDEwOlJlcG9zaXRvcnkxMzcwODU4", + "name": "reponame", + "full_name": "owner/reponame", + "private": false, + "owner": { + "login": "kiegroup", + "id": 517980, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjUxNzk4MA==", + "avatar_url": "https://avatars.codebergusercontent.com/u/517980?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/kiegroup", + "html_url": "https://codeberg.org/kiegroup", + "followers_url": "https://codeberg.org/api/v1/users/kiegroup/followers", + "following_url": "https://codeberg.org/api/v1/users/kiegroup/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/kiegroup/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/kiegroup/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/kiegroup/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/kiegroup/orgs", + "repos_url": "https://codeberg.org/api/v1/users/kiegroup/repos", + "events_url": "https://codeberg.org/api/v1/users/kiegroup/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/kiegroup/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://codeberg.org/owner/reponame", + "description": "AI constraint solver in Java to optimize the vehicle routing problem, employee rostering, task assignment, maintenance scheduling, conference scheduling and other planning problems.", + "fork": false, + "url": "https://codeberg.org/api/v1/repos/owner/reponame", + "forks_url": "https://codeberg.org/api/v1/repos/owner/reponame/forks", + "keys_url": "https://codeberg.org/api/v1/repos/owner/reponame/keys{/key_id}", + "collaborators_url": "https://codeberg.org/api/v1/repos/owner/reponame/collaborators{/collaborator}", + "teams_url": "https://codeberg.org/api/v1/repos/owner/reponame/teams", + "hooks_url": "https://codeberg.org/api/v1/repos/owner/reponame/hooks", + "issue_events_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/events{/number}", + "events_url": "https://codeberg.org/api/v1/repos/owner/reponame/events", + "assignees_url": "https://codeberg.org/api/v1/repos/owner/reponame/assignees{/user}", + "branches_url": "https://codeberg.org/api/v1/repos/owner/reponame/branches{/branch}", + "tags_url": "https://codeberg.org/api/v1/repos/owner/reponame/tags", + "blobs_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/blobs{/sha}", + "git_tags_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/tags{/sha}", + "git_refs_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/refs{/sha}", + "trees_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/trees{/sha}", + "statuses_url": "https://codeberg.org/api/v1/repos/owner/reponame/statuses/{sha}", + "languages_url": "https://codeberg.org/api/v1/repos/owner/reponame/languages", + "stargazers_url": "https://codeberg.org/api/v1/repos/owner/reponame/stargazers", + "contributors_url": "https://codeberg.org/api/v1/repos/owner/reponame/contributors", + "subscribers_url": "https://codeberg.org/api/v1/repos/owner/reponame/subscribers", + "subscription_url": "https://codeberg.org/api/v1/repos/owner/reponame/subscription", + "commits_url": "https://codeberg.org/api/v1/repos/owner/reponame/commits{/sha}", + "git_commits_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/commits{/sha}", + "comments_url": "https://codeberg.org/api/v1/repos/owner/reponame/comments{/number}", + "issue_comment_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/comments{/number}", + "contents_url": "https://codeberg.org/api/v1/repos/owner/reponame/contents/{+path}", + "compare_url": "https://codeberg.org/api/v1/repos/owner/reponame/compare/{base}...{head}", + "merges_url": "https://codeberg.org/api/v1/repos/owner/reponame/merges", + "archive_url": "https://codeberg.org/api/v1/repos/owner/reponame/{archive_format}{/ref}", + "downloads_url": "https://codeberg.org/api/v1/repos/owner/reponame/downloads", + "issues_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues{/number}", + "pulls_url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls{/number}", + "milestones_url": "https://codeberg.org/api/v1/repos/owner/reponame/milestones{/number}", + "notifications_url": "https://codeberg.org/api/v1/repos/owner/reponame/notifications{?since,all,participating}", + "labels_url": "https://codeberg.org/api/v1/repos/owner/reponame/labels{/name}", + "releases_url": "https://codeberg.org/api/v1/repos/owner/reponame/releases{/id}", + "deployments_url": "https://codeberg.org/api/v1/repos/owner/reponame/deployments", + "created_at": "2011-02-15T19:38:23Z", + "updated_at": "2022-11-28T05:01:47Z", + "pushed_at": "2022-11-28T10:50:51Z", + "git_url": "git://codeberg.org/owner/reponame.git", + "ssh_url": "git@codeberg.org:owner/reponame.git", + "clone_url": "https://codeberg.org/owner/reponame.git", + "svn_url": "https://codeberg.org/owner/reponame", + "homepage": "https://www.reponame.org", + "size": 238339, + "stargazers_count": 2811, + "watchers_count": 2811, + "language": "Java", + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 878, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 30, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://codeberg.org/api/v1/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "artificial-intelligence", + "branch-and-bound", + "constraint-programming", + "constraint-satisfaction-problem", + "constraint-solver", + "constraints", + "employee-rostering", + "java", + "local-search", + "mathematical-optimization", + "metaheuristics", + "optimization", + "rostering", + "scheduling", + "simulated-annealing", + "solver", + "tabu-search", + "traveling-salesman", + "traveling-salesman-problem", + "vehicle-routing-problem" + ], + "visibility": "public", + "forks": 878, + "open_issues": 30, + "watchers": 2811, + "default_branch": "main" + } + }, + "base": { + "label": "kiegroup:8.31.x", + "ref": "8.31.x", + "sha": "8cfc286765cb01c84a1d62c65519fa8032bfecbd", + "user": { + "login": "kiegroup", + "id": 517980, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjUxNzk4MA==", + "avatar_url": "https://avatars.codebergusercontent.com/u/517980?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/kiegroup", + "html_url": "https://codeberg.org/kiegroup", + "followers_url": "https://codeberg.org/api/v1/users/kiegroup/followers", + "following_url": "https://codeberg.org/api/v1/users/kiegroup/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/kiegroup/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/kiegroup/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/kiegroup/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/kiegroup/orgs", + "repos_url": "https://codeberg.org/api/v1/users/kiegroup/repos", + "events_url": "https://codeberg.org/api/v1/users/kiegroup/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/kiegroup/received_events", + "type": "Organization", + "site_admin": false + }, + "repo": { + "id": 1370858, + "node_id": "MDEwOlJlcG9zaXRvcnkxMzcwODU4", + "name": "reponame", + "full_name": "owner/reponame", + "private": false, + "owner": { + "login": "kiegroup", + "id": 517980, + "node_id": "MDEyOk9yZ2FuaXphdGlvbjUxNzk4MA==", + "avatar_url": "https://avatars.codebergusercontent.com/u/517980?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/kiegroup", + "html_url": "https://codeberg.org/kiegroup", + "followers_url": "https://codeberg.org/api/v1/users/kiegroup/followers", + "following_url": "https://codeberg.org/api/v1/users/kiegroup/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/kiegroup/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/kiegroup/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/kiegroup/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/kiegroup/orgs", + "repos_url": "https://codeberg.org/api/v1/users/kiegroup/repos", + "events_url": "https://codeberg.org/api/v1/users/kiegroup/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/kiegroup/received_events", + "type": "Organization", + "site_admin": false + }, + "html_url": "https://codeberg.org/owner/reponame", + "description": "AI constraint solver in Java to optimize the vehicle routing problem, employee rostering, task assignment, maintenance scheduling, conference scheduling and other planning problems.", + "fork": false, + "url": "https://codeberg.org/api/v1/repos/owner/reponame", + "forks_url": "https://codeberg.org/api/v1/repos/owner/reponame/forks", + "keys_url": "https://codeberg.org/api/v1/repos/owner/reponame/keys{/key_id}", + "collaborators_url": "https://codeberg.org/api/v1/repos/owner/reponame/collaborators{/collaborator}", + "teams_url": "https://codeberg.org/api/v1/repos/owner/reponame/teams", + "hooks_url": "https://codeberg.org/api/v1/repos/owner/reponame/hooks", + "issue_events_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/events{/number}", + "events_url": "https://codeberg.org/api/v1/repos/owner/reponame/events", + "assignees_url": "https://codeberg.org/api/v1/repos/owner/reponame/assignees{/user}", + "branches_url": "https://codeberg.org/api/v1/repos/owner/reponame/branches{/branch}", + "tags_url": "https://codeberg.org/api/v1/repos/owner/reponame/tags", + "blobs_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/blobs{/sha}", + "git_tags_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/tags{/sha}", + "git_refs_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/refs{/sha}", + "trees_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/trees{/sha}", + "statuses_url": "https://codeberg.org/api/v1/repos/owner/reponame/statuses/{sha}", + "languages_url": "https://codeberg.org/api/v1/repos/owner/reponame/languages", + "stargazers_url": "https://codeberg.org/api/v1/repos/owner/reponame/stargazers", + "contributors_url": "https://codeberg.org/api/v1/repos/owner/reponame/contributors", + "subscribers_url": "https://codeberg.org/api/v1/repos/owner/reponame/subscribers", + "subscription_url": "https://codeberg.org/api/v1/repos/owner/reponame/subscription", + "commits_url": "https://codeberg.org/api/v1/repos/owner/reponame/commits{/sha}", + "git_commits_url": "https://codeberg.org/api/v1/repos/owner/reponame/git/commits{/sha}", + "comments_url": "https://codeberg.org/api/v1/repos/owner/reponame/comments{/number}", + "issue_comment_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues/comments{/number}", + "contents_url": "https://codeberg.org/api/v1/repos/owner/reponame/contents/{+path}", + "compare_url": "https://codeberg.org/api/v1/repos/owner/reponame/compare/{base}...{head}", + "merges_url": "https://codeberg.org/api/v1/repos/owner/reponame/merges", + "archive_url": "https://codeberg.org/api/v1/repos/owner/reponame/{archive_format}{/ref}", + "downloads_url": "https://codeberg.org/api/v1/repos/owner/reponame/downloads", + "issues_url": "https://codeberg.org/api/v1/repos/owner/reponame/issues{/number}", + "pulls_url": "https://codeberg.org/api/v1/repos/owner/reponame/pulls{/number}", + "milestones_url": "https://codeberg.org/api/v1/repos/owner/reponame/milestones{/number}", + "notifications_url": "https://codeberg.org/api/v1/repos/owner/reponame/notifications{?since,all,participating}", + "labels_url": "https://codeberg.org/api/v1/repos/owner/reponame/labels{/name}", + "releases_url": "https://codeberg.org/api/v1/repos/owner/reponame/releases{/id}", + "deployments_url": "https://codeberg.org/api/v1/repos/owner/reponame/deployments", + "created_at": "2011-02-15T19:38:23Z", + "updated_at": "2022-11-28T05:01:47Z", + "pushed_at": "2022-11-28T10:50:51Z", + "git_url": "git://codeberg.org/owner/reponame.git", + "ssh_url": "git@codeberg.org:owner/reponame.git", + "clone_url": "https://codeberg.org/owner/reponame.git", + "svn_url": "https://codeberg.org/owner/reponame", + "homepage": "https://www.reponame.org", + "size": 238339, + "stargazers_count": 2811, + "watchers_count": 2811, + "language": "Java", + "has_issues": false, + "has_projects": false, + "has_downloads": true, + "has_wiki": false, + "has_pages": false, + "has_discussions": false, + "forks_count": 878, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 30, + "license": { + "key": "apache-2.0", + "name": "Apache License 2.0", + "spdx_id": "Apache-2.0", + "url": "https://codeberg.org/api/v1/licenses/apache-2.0", + "node_id": "MDc6TGljZW5zZTI=" + }, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [ + "artificial-intelligence", + "branch-and-bound", + "constraint-programming", + "constraint-satisfaction-problem", + "constraint-solver", + "constraints", + "employee-rostering", + "java", + "local-search", + "mathematical-optimization", + "metaheuristics", + "optimization", + "rostering", + "scheduling", + "simulated-annealing", + "solver", + "tabu-search", + "traveling-salesman", + "traveling-salesman-problem", + "vehicle-routing-problem" + ], + "visibility": "public", + "forks": 878, + "open_issues": 30, + "watchers": 2811, + "default_branch": "main" + } + }, + "_links": { + "self": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/8632" + }, + "html": { + "href": "https://codeberg.org/owner/reponame/pulls/8632" + }, + "issue": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/issues/8632" + }, + "comments": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/issues/8632/comments" + }, + "review_comments": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/8632/comments" + }, + "review_comment": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/comments{/number}" + }, + "commits": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/pulls/8632/commits" + }, + "statuses": { + "href": "https://codeberg.org/api/v1/repos/owner/reponame/statuses/91748965051fae1330ad58d15cf694e103267c87" + } + }, + "author_association": "CONTRIBUTOR", + "auto_merge": null, + "active_lock_reason": null, + "merged": true, + "mergeable": null, + "rebaseable": null, + "mergeable_state": "unknown", + "merged_by": { + "login": "that-s-a-user", + "id": 17157711, + "node_id": "MDQ6VXNlcjE3MTU3NzEx", + "avatar_url": "https://avatars.codebergusercontent.com/u/17157711?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/that-s-a-user", + "html_url": "https://codeberg.org/that-s-a-user", + "followers_url": "https://codeberg.org/api/v1/users/that-s-a-user/followers", + "following_url": "https://codeberg.org/api/v1/users/that-s-a-user/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/that-s-a-user/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/that-s-a-user/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/that-s-a-user/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/that-s-a-user/orgs", + "repos_url": "https://codeberg.org/api/v1/users/that-s-a-user/repos", + "events_url": "https://codeberg.org/api/v1/users/that-s-a-user/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/that-s-a-user/received_events", + "type": "User", + "site_admin": false + }, + "comments": 0, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 2, + "additions": 2, + "deletions": 2, + "changed_files": 2 +}; + +export const CODEBERG_GET_COMMIT = { + "parents": [ + { + "sha": "SHA" + } + ] +}; + +export const CB_MULT_COMMITS_PR_COMMITS = [ + { + "sha": "0404fb922ab75c3a8aecad5c97d9af388df04695", + "node_id": "C_kwDOImgs99oAKDA0MDRmYjkyMmFiNzVjM2E4YWVjYWQ1Yzk3ZDlhZjM4OGRmMDQ2OTU", + "commit": { + "author": { + "name": "owner", + "email": "owner@email.com", + "date": "2023-07-06T13:46:30Z" + }, + "committer": { + "name": "Codeberg", + "email": "noreply@codeberg.org", + "date": "2023-07-06T13:46:30Z" + }, + "message": "Update file1.txt", + "tree": { + "sha": "50be1d7031b02a2ae609f432f2a1e0f818d827b2", + "url": "https://codeberg.org/api/v1/repos/owner/reponame/git/trees/50be1d7031b02a2ae609f432f2a1e0f818d827b2" + }, + "url": "https://codeberg.org/api/v1/repos/owner/reponame/git/commits/0404fb922ab75c3a8aecad5c97d9af388df04695", + "comment_count": 0, + "verification": { + "verified": true, + "reason": "valid", + "signature": "-----BEGIN PGP SIGNATURE-----\n\nno-signature=\n=fivd\n-----END PGP SIGNATURE-----\n", + "payload": "tree 50be1d7031b02a2ae609f432f2a1e0f818d827b2\nparent c85b8fcdb741814b3e90e6e5729455cf46ff26ea\nauthor Owner 1688651190 +0200\ncommitter Codeberg 1688651190 +0200\n\nUpdate file1.txt" + } + }, + "url": "https://codeberg.org/api/v1/repos/owner/reponame/commits/0404fb922ab75c3a8aecad5c97d9af388df04695", + "html_url": "https://codeberg.org/owner/reponame/commit/0404fb922ab75c3a8aecad5c97d9af388df04695", + "comments_url": "https://codeberg.org/api/v1/repos/owner/reponame/commits/0404fb922ab75c3a8aecad5c97d9af388df04695/comments", + "author": { + "login": "owner", + "id": 26715795, + "node_id": "MDQ6VXNlcjI2NzE1Nzk1", + "avatar_url": "https://avatars.codebergusercontent.com/u/26715795?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/owner", + "html_url": "https://codeberg.org/owner", + "followers_url": "https://codeberg.org/api/v1/users/owner/followers", + "following_url": "https://codeberg.org/api/v1/users/owner/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/owner/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/owner/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/owner/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/owner/orgs", + "repos_url": "https://codeberg.org/api/v1/users/owner/repos", + "events_url": "https://codeberg.org/api/v1/users/owner/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/owner/received_events", + "type": "User", + "site_admin": false + }, + "committer": { + "login": "web-flow", + "id": 19864447, + "node_id": "MDQ6VXNlcjE5ODY0NDQ3", + "avatar_url": "https://avatars.codebergusercontent.com/u/19864447?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/web-flow", + "html_url": "https://codeberg.org/web-flow", + "followers_url": "https://codeberg.org/api/v1/users/web-flow/followers", + "following_url": "https://codeberg.org/api/v1/users/web-flow/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/web-flow/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/web-flow/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/web-flow/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/web-flow/orgs", + "repos_url": "https://codeberg.org/api/v1/users/web-flow/repos", + "events_url": "https://codeberg.org/api/v1/users/web-flow/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/web-flow/received_events", + "type": "User", + "site_admin": false + }, + "parents": [ + { + "sha": "c85b8fcdb741814b3e90e6e5729455cf46ff26ea", + "url": "https://codeberg.org/api/v1/repos/owner/reponame/commits/c85b8fcdb741814b3e90e6e5729455cf46ff26ea", + "html_url": "https://codeberg.org/owner/reponame/commit/c85b8fcdb741814b3e90e6e5729455cf46ff26ea" + } + ] + }, + { + "sha": "11da4e38aa3e577ffde6d546f1c52e53b04d3151", + "node_id": "C_kwDOImgs99oAKDExZGE0ZTM4YWEzZTU3N2ZmZGU2ZDU0NmYxYzUyZTUzYjA0ZDMxNTE", + "commit": { + "author": { + "name": "Owner", + "email": "owner@email.com", + "date": "2023-07-10T13:23:44Z" + }, + "committer": { + "name": "Codeberg", + "email": "noreply@codeberg.org", + "date": "2023-07-10T13:23:44Z" + }, + "message": "Update file2.txt", + "tree": { + "sha": "fdd16fb791eef26fd84c3bfa34fd89eb1f7a85be", + "url": "https://codeberg.org/api/v1/repos/owner/reponame/git/trees/fdd16fb791eef26fd84c3bfa34fd89eb1f7a85be" + }, + "url": "https://codeberg.org/api/v1/repos/owner/reponame/git/commits/11da4e38aa3e577ffde6d546f1c52e53b04d3151", + "comment_count": 0, + "verification": { + "verified": true, + "reason": "valid", + "signature": "-----BEGIN PGP SIGNATURE-----\n\nno-signature\n=//hm\n-----END PGP SIGNATURE-----\n", + "payload": "tree fdd16fb791eef26fd84c3bfa34fd89eb1f7a85be\nparent 0404fb922ab75c3a8aecad5c97d9af388df04695\nauthor Owner 1688995424 +0200\ncommitter Codeberg 1688995424 +0200\n\nUpdate file2.txt" + } + }, + "url": "https://codeberg.org/api/v1/repos/owner/reponame/commits/11da4e38aa3e577ffde6d546f1c52e53b04d3151", + "html_url": "https://codeberg.org/owner/reponame/commit/11da4e38aa3e577ffde6d546f1c52e53b04d3151", + "comments_url": "https://codeberg.org/api/v1/repos/owner/reponame/commits/11da4e38aa3e577ffde6d546f1c52e53b04d3151/comments", + "author": { + "login": "owner", + "id": 26715795, + "node_id": "MDQ6VXNlcjI2NzE1Nzk1", + "avatar_url": "https://avatars.codebergusercontent.com/u/26715795?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/owner", + "html_url": "https://codeberg.org/owner", + "followers_url": "https://codeberg.org/api/v1/users/owner/followers", + "following_url": "https://codeberg.org/api/v1/users/owner/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/owner/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/owner/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/owner/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/owner/orgs", + "repos_url": "https://codeberg.org/api/v1/users/owner/repos", + "events_url": "https://codeberg.org/api/v1/users/owner/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/owner/received_events", + "type": "User", + "site_admin": false + }, + "committer": { + "login": "web-flow", + "id": 19864447, + "node_id": "MDQ6VXNlcjE5ODY0NDQ3", + "avatar_url": "https://avatars.codebergusercontent.com/u/19864447?v=4", + "gravatar_id": "", + "url": "https://codeberg.org/api/v1/users/web-flow", + "html_url": "https://codeberg.org/web-flow", + "followers_url": "https://codeberg.org/api/v1/users/web-flow/followers", + "following_url": "https://codeberg.org/api/v1/users/web-flow/following{/other_user}", + "gists_url": "https://codeberg.org/api/v1/users/web-flow/gists{/gist_id}", + "starred_url": "https://codeberg.org/api/v1/users/web-flow/starred{/owner}{/repo}", + "subscriptions_url": "https://codeberg.org/api/v1/users/web-flow/subscriptions", + "organizations_url": "https://codeberg.org/api/v1/users/web-flow/orgs", + "repos_url": "https://codeberg.org/api/v1/users/web-flow/repos", + "events_url": "https://codeberg.org/api/v1/users/web-flow/events{/privacy}", + "received_events_url": "https://codeberg.org/api/v1/users/web-flow/received_events", + "type": "User", + "site_admin": false + }, + "parents": [ + { + "sha": "0404fb922ab75c3a8aecad5c97d9af388df04695", + "url": "https://codeberg.org/api/v1/repos/owner/reponame/commits/0404fb922ab75c3a8aecad5c97d9af388df04695", + "html_url": "https://codeberg.org/owner/reponame/commit/0404fb922ab75c3a8aecad5c97d9af388df04695" + } + ] + } +]; \ No newline at end of file diff --git a/test/support/mock/git-client-mock-support.ts b/test/support/mock/git-client-mock-support.ts index 72a46aa..6c81f91 100644 --- a/test/support/mock/git-client-mock-support.ts +++ b/test/support/mock/git-client-mock-support.ts @@ -2,6 +2,7 @@ import LoggerServiceFactory from "@bp/service/logger/logger-service-factory"; import { Moctokit } from "@kie/mock-github"; import { TARGET_OWNER, REPO, MERGED_PR_FIXTURE, OPEN_PR_FIXTURE, NOT_MERGED_PR_FIXTURE, NOT_FOUND_PR_NUMBER, MULT_COMMITS_PR_FIXTURE, MULT_COMMITS_PR_COMMITS, NEW_PR_URL, NEW_PR_NUMBER, GITHUB_GET_COMMIT } from "./github-data"; import { CLOSED_NOT_MERGED_MR, MERGED_SQUASHED_MR, NESTED_NAMESPACE_MR, OPEN_MR, OPEN_PR_COMMITS, PROJECT_EXAMPLE, NESTED_PROJECT_EXAMPLE, SUPERUSER, MERGED_SQUASHED_MR_COMMITS } from "./gitlab-data"; +import { CB_TARGET_OWNER, CB_REPO, CB_MERGED_PR_FIXTURE, CB_OPEN_PR_FIXTURE, CB_NOT_MERGED_PR_FIXTURE, CB_NOT_FOUND_PR_NUMBER, CB_MULT_COMMITS_PR_FIXTURE, CB_MULT_COMMITS_PR_COMMITS, CB_NEW_PR_URL, CB_NEW_PR_NUMBER, CODEBERG_GET_COMMIT } from "./codeberg-data"; // high number, for each test we are not expecting // to send more than 3 reqs per api endpoint @@ -239,3 +240,151 @@ export const mockGitHubClient = (apiUrl = "https://api.github.com"): Moctokit => return mock; }; + +// CODEBERG - OCTOKIT + +export const mockCodebergClient = (apiUrl = "https://codeberg.org/api/v1"): Moctokit => { + logger.debug("Setting up moctokit.."); + + const mock = new Moctokit(apiUrl); + + // setup the mock requests here + + // valid requests + mock.rest.pulls + .get({ + owner: CB_TARGET_OWNER, + repo: CB_REPO, + pull_number: CB_MERGED_PR_FIXTURE.number + }) + .reply({ + status: 200, + data: CB_MERGED_PR_FIXTURE + }); + + mock.rest.pulls + .get({ + owner: CB_TARGET_OWNER, + repo: CB_REPO, + pull_number: CB_MULT_COMMITS_PR_FIXTURE.number + }) + .reply({ + status: 200, + data: CB_MULT_COMMITS_PR_FIXTURE + }); + + mock.rest.pulls + .get({ + owner: CB_TARGET_OWNER, + repo: CB_REPO, + pull_number: CB_OPEN_PR_FIXTURE.number + }) + .reply({ + status: 200, + data: CB_OPEN_PR_FIXTURE + }); + + mock.rest.pulls + .get({ + owner: CB_TARGET_OWNER, + repo: CB_REPO, + pull_number: CB_NOT_MERGED_PR_FIXTURE.number + }) + .reply({ + status: 200, + data: CB_NOT_MERGED_PR_FIXTURE + }); + + mock.rest.pulls + .listCommits({ + owner: CB_TARGET_OWNER, + repo: CB_REPO, + pull_number: CB_MULT_COMMITS_PR_FIXTURE.number + }) + .reply({ + status: 200, + data: CB_MULT_COMMITS_PR_COMMITS + }); + + mock.rest.pulls + .listCommits({ + owner: CB_TARGET_OWNER, + repo: CB_REPO, + pull_number: CB_OPEN_PR_FIXTURE.number + }) + .reply({ + status: 200, + data: CB_MULT_COMMITS_PR_COMMITS + }); + + mock.rest.pulls + .create() + .reply({ + repeat: REPEAT, + status: 201, + data: { + number: CB_NEW_PR_NUMBER, + html_url: CB_NEW_PR_URL, + } + }); + + mock.rest.pulls + .requestReviewers() + .reply({ + repeat: REPEAT, + status: 201, + data: CB_MERGED_PR_FIXTURE + }); + + mock.rest.issues + .addAssignees() + .reply({ + repeat: REPEAT, + status: 201, + data: {} + }); + + mock.rest.issues + .addLabels() + .reply({ + repeat: REPEAT, + status: 200, + data: {} + }); + + mock.rest.issues + .createComment() + .reply({ + repeat: REPEAT, + status: 201, + data: {} + }); + + mock.rest.git + .getCommit({ + owner: CB_TARGET_OWNER, + repo: CB_REPO, + commit_sha: "28f63db774185f4ec4b57cd9aaeb12dbfb4c9ecc", + }) + .reply({ + status: 200, + data: CODEBERG_GET_COMMIT, + }); + + // invalid requests + mock.rest.pulls + .get({ + owner: CB_TARGET_OWNER, + repo: CB_REPO, + pull_number: CB_NOT_FOUND_PR_NUMBER + }) + .reply({ + repeat: REPEAT, + status: 404, + data: { + message: "Not found" + } + }); + + return mock; +};