package common

import (
	"os"
	"strings"
	"testing"
)

func TestPrParsing(t *testing.T) {
	t.Run("Test parsing", func(t *testing.T) {
		var h RequestHandler
		h.StdLogger, h.ErrLogger = CreateStdoutLogger(os.Stdout, os.Stdout)

		pr := h.parsePullRequest(strings.NewReader(samplePR_JSON))
		if pr == nil {
			t.Fatalf("parsing PR failed: %v", h.Error)
		}

		prs := h.parsePullRequest(strings.NewReader(samplePRsync_JSON))
		if prs == nil {
			t.Fatalf("parsing PR failed: %v", h.Error)
		}
	})
}

const samplePR_JSON = `{
  "action": "opened",
  "number": 1,
  "pull_request": {
    "id": 469,
    "url": "https://src.opensuse.org/autogits/nodejs21/pulls/1",
    "number": 1,
    "user": {
      "id": 129,
      "login": "adamm",
      "login_name": "",
      "source_id": 0,
      "full_name": "Adam Majer",
      "email": "adamm@noreply@src.opensuse.org",
      "avatar_url": "https://src.opensuse.org/avatar/babb6ae054a709c238a4e9b0f2b53d53",
      "html_url": "https://src.opensuse.org/adamm",
      "language": "",
      "is_admin": false,
      "last_login": "0001-01-01T00:00:00Z",
      "created": "2023-07-21T16:43:48+02:00",
      "restricted": false,
      "active": false,
      "prohibit_login": false,
      "location": "",
      "website": "",
      "description": "",
      "visibility": "public",
      "followers_count": 0,
      "following_count": 0,
      "starred_repos_count": 0,
      "username": "adamm"
    },
    "title": "Update test",
    "body": "This is a test of PR workflow",
    "labels": [],
    "milestone": null,
    "assignee": null,
    "assignees": null,
    "requested_reviewers": null,
    "state": "open",
    "draft": false,
    "is_locked": false,
    "comments": 0,
    "review_comments": 0,
    "additions": 1,
    "deletions": 1,
    "changed_files": 1,
    "html_url": "https://src.opensuse.org/autogits/nodejs21/pulls/1",
    "diff_url": "https://src.opensuse.org/autogits/nodejs21/pulls/1.diff",
    "patch_url": "https://src.opensuse.org/autogits/nodejs21/pulls/1.patch",
    "mergeable": true,
    "merged": false,
    "merged_at": null,
    "merge_commit_sha": null,
    "merged_by": null,
    "allow_maintainer_edit": false,
    "base": {
      "label": "factory",
      "ref": "factory",
      "sha": "24ee6bee7459a386dadabf8a9f6ae4fa15c3f810bfa01cee5238138aa214d180",
      "repo_id": 90578,
      "repo": {
        "id": 90578,
        "owner": {
          "id": 983,
          "login": "autogits",
          "login_name": "",
          "source_id": 0,
          "full_name": "",
          "email": "",
          "avatar_url": "https://src.opensuse.org/avatars/80a61ef3a14c3c22f0b8b1885d1a75d4",
          "html_url": "https://src.opensuse.org/autogits",
          "language": "",
          "is_admin": false,
          "last_login": "0001-01-01T00:00:00Z",
          "created": "2024-06-20T09:46:37+02:00",
          "restricted": false,
          "active": false,
          "prohibit_login": false,
          "location": "",
          "website": "",
          "description": "",
          "visibility": "public",
          "followers_count": 0,
          "following_count": 0,
          "starred_repos_count": 0,
          "username": "autogits"
        },
        "name": "nodejs21",
        "full_name": "autogits/nodejs21",
        "description": "",
        "empty": false,
        "private": false,
        "fork": true,
        "template": false,
        "parent": {
          "id": 71125,
          "owner": {
            "id": 64,
            "login": "pool",
            "login_name": "",
            "source_id": 0,
            "full_name": "",
            "email": "",
            "avatar_url": "https://src.opensuse.org/avatars/b10a8c0bede9eb4ea771b04db3149f28",
            "html_url": "https://src.opensuse.org/pool",
            "language": "",
            "is_admin": false,
            "last_login": "0001-01-01T00:00:00Z",
            "created": "2023-03-01T14:41:17+01:00",
            "restricted": false,
            "active": false,
            "prohibit_login": false,
            "location": "",
            "website": "",
            "description": "",
            "visibility": "public",
            "followers_count": 0,
            "following_count": 0,
            "starred_repos_count": 0,
            "username": "pool"
          },
          "name": "nodejs21",
          "full_name": "pool/nodejs21",
          "description": "",
          "empty": false,
          "private": false,
          "fork": false,
          "template": false,
          "parent": null,
          "mirror": false,
          "size": 1471,
          "language": "",
          "languages_url": "https://src.opensuse.org/api/v1/repos/pool/nodejs21/languages",
          "html_url": "https://src.opensuse.org/pool/nodejs21",
          "url": "https://src.opensuse.org/api/v1/repos/pool/nodejs21",
          "link": "",
          "ssh_url": "gitea@src.opensuse.org:pool/nodejs21.git",
          "clone_url": "https://src.opensuse.org/pool/nodejs21.git",
          "original_url": "",
          "website": "",
          "stars_count": 0,
          "forks_count": 2,
          "watchers_count": 2,
          "open_issues_count": 0,
          "open_pr_counter": 0,
          "release_counter": 0,
          "default_branch": "factory",
          "archived": false,
          "created_at": "2024-06-17T17:17:37+02:00",
          "updated_at": "2024-06-18T09:03:36+02:00",
          "archived_at": "1970-01-01T01:00:00+01:00",
          "permissions": {
            "admin": false,
            "push": false,
            "pull": true
          },
          "has_issues": true,
          "internal_tracker": {
            "enable_time_tracker": false,
            "allow_only_contributors_to_track_time": true,
            "enable_issue_dependencies": true
          },
          "has_wiki": true,
          "has_pull_requests": true,
          "has_projects": true,
          "projects_mode": "all",
          "has_releases": true,
          "has_packages": true,
          "has_actions": true,
          "ignore_whitespace_conflicts": false,
          "allow_merge_commits": true,
          "allow_rebase": true,
          "allow_rebase_explicit": true,
          "allow_squash_merge": true,
          "allow_fast_forward_only_merge": true,
          "allow_rebase_update": true,
          "default_delete_branch_after_merge": false,
          "default_merge_style": "merge",
          "default_allow_maintainer_edit": false,
          "avatar_url": "https://src.opensuse.org/",
          "internal": false,
          "mirror_interval": "",
          "object_format_name": "sha256",
          "mirror_updated": "0001-01-01T00:00:00Z",
          "repo_transfer": null
        },
        "mirror": false,
        "size": 1471,
        "language": "",
        "languages_url": "https://src.opensuse.org/api/v1/repos/autogits/nodejs21/languages",
        "html_url": "https://src.opensuse.org/autogits/nodejs21",
        "url": "https://src.opensuse.org/api/v1/repos/autogits/nodejs21",
        "link": "",
        "ssh_url": "gitea@src.opensuse.org:autogits/nodejs21.git",
        "clone_url": "https://src.opensuse.org/autogits/nodejs21.git",
        "original_url": "",
        "website": "",
        "stars_count": 0,
        "forks_count": 1,
        "watchers_count": 2,
        "open_issues_count": 0,
        "open_pr_counter": 0,
        "release_counter": 0,
        "default_branch": "factory",
        "archived": false,
        "created_at": "2024-07-09T23:40:35+02:00",
        "updated_at": "2024-07-09T23:40:35+02:00",
        "archived_at": "1970-01-01T01:00:00+01:00",
        "permissions": {
          "admin": false,
          "push": false,
          "pull": true
        },
        "has_issues": false,
        "has_wiki": false,
        "has_pull_requests": true,
        "has_projects": false,
        "projects_mode": "all",
        "has_releases": false,
        "has_packages": false,
        "has_actions": false,
        "ignore_whitespace_conflicts": false,
        "allow_merge_commits": true,
        "allow_rebase": true,
        "allow_rebase_explicit": true,
        "allow_squash_merge": true,
        "allow_fast_forward_only_merge": true,
        "allow_rebase_update": true,
        "default_delete_branch_after_merge": false,
        "default_merge_style": "merge",
        "default_allow_maintainer_edit": false,
        "avatar_url": "https://src.opensuse.org/",
        "internal": false,
        "mirror_interval": "",
        "object_format_name": "sha256",
        "mirror_updated": "0001-01-01T00:00:00Z",
        "repo_transfer": null
      }
    },
    "head": {
      "label": "factory",
      "ref": "factory",
      "sha": "c678c57007d496a98bec668ae38f2c26a695f94af78012f15d044ccf066ccb41",
      "repo_id": 90579,
      "repo": {
        "id": 90579,
        "owner": {
          "id": 129,
          "login": "adamm",
          "login_name": "",
          "source_id": 0,
          "full_name": "Adam Majer",
          "email": "adamm@noreply@src.opensuse.org",
          "avatar_url": "https://src.opensuse.org/avatar/babb6ae054a709c238a4e9b0f2b53d53",
          "html_url": "https://src.opensuse.org/adamm",
          "language": "",
          "is_admin": false,
          "last_login": "0001-01-01T00:00:00Z",
          "created": "2023-07-21T16:43:48+02:00",
          "restricted": false,
          "active": false,
          "prohibit_login": false,
          "location": "",
          "website": "",
          "description": "",
          "visibility": "public",
          "followers_count": 0,
          "following_count": 0,
          "starred_repos_count": 0,
          "username": "adamm"
        },
        "name": "nodejs21",
        "full_name": "adamm/nodejs21",
        "description": "",
        "empty": false,
        "private": false,
        "fork": true,
        "template": false,
        "parent": {
          "id": 90578,
          "owner": {
            "id": 983,
            "login": "autogits",
            "login_name": "",
            "source_id": 0,
            "full_name": "",
            "email": "",
            "avatar_url": "https://src.opensuse.org/avatars/80a61ef3a14c3c22f0b8b1885d1a75d4",
            "html_url": "https://src.opensuse.org/autogits",
            "language": "",
            "is_admin": false,
            "last_login": "0001-01-01T00:00:00Z",
            "created": "2024-06-20T09:46:37+02:00",
            "restricted": false,
            "active": false,
            "prohibit_login": false,
            "location": "",
            "website": "",
            "description": "",
            "visibility": "public",
            "followers_count": 0,
            "following_count": 0,
            "starred_repos_count": 0,
            "username": "autogits"
          },
          "name": "nodejs21",
          "full_name": "autogits/nodejs21",
          "description": "",
          "empty": false,
          "private": false,
          "fork": true,
          "template": false,
          "parent": null,
          "mirror": false,
          "size": 1471,
          "language": "",
          "languages_url": "https://src.opensuse.org/api/v1/repos/autogits/nodejs21/languages",
          "html_url": "https://src.opensuse.org/autogits/nodejs21",
          "url": "https://src.opensuse.org/api/v1/repos/autogits/nodejs21",
          "link": "",
          "ssh_url": "gitea@src.opensuse.org:autogits/nodejs21.git",
          "clone_url": "https://src.opensuse.org/autogits/nodejs21.git",
          "original_url": "",
          "website": "",
          "stars_count": 0,
          "forks_count": 1,
          "watchers_count": 2,
          "open_issues_count": 0,
          "open_pr_counter": 1,
          "release_counter": 0,
          "default_branch": "factory",
          "archived": false,
          "created_at": "2024-07-09T23:40:35+02:00",
          "updated_at": "2024-07-09T23:40:35+02:00",
          "archived_at": "1970-01-01T01:00:00+01:00",
          "permissions": {
            "admin": false,
            "push": false,
            "pull": true
          },
          "has_issues": false,
          "has_wiki": false,
          "has_pull_requests": true,
          "has_projects": false,
          "projects_mode": "all",
          "has_releases": false,
          "has_packages": false,
          "has_actions": false,
          "ignore_whitespace_conflicts": false,
          "allow_merge_commits": true,
          "allow_rebase": true,
          "allow_rebase_explicit": true,
          "allow_squash_merge": true,
          "allow_fast_forward_only_merge": true,
          "allow_rebase_update": true,
          "default_delete_branch_after_merge": false,
          "default_merge_style": "merge",
          "default_allow_maintainer_edit": false,
          "avatar_url": "https://src.opensuse.org/",
          "internal": false,
          "mirror_interval": "",
          "object_format_name": "sha256",
          "mirror_updated": "0001-01-01T00:00:00Z",
          "repo_transfer": null
        },
        "mirror": false,
        "size": 1473,
        "language": "",
        "languages_url": "https://src.opensuse.org/api/v1/repos/adamm/nodejs21/languages",
        "html_url": "https://src.opensuse.org/adamm/nodejs21",
        "url": "https://src.opensuse.org/api/v1/repos/adamm/nodejs21",
        "link": "",
        "ssh_url": "gitea@src.opensuse.org:adamm/nodejs21.git",
        "clone_url": "https://src.opensuse.org/adamm/nodejs21.git",
        "original_url": "",
        "website": "",
        "stars_count": 0,
        "forks_count": 0,
        "watchers_count": 1,
        "open_issues_count": 0,
        "open_pr_counter": 0,
        "release_counter": 0,
        "default_branch": "factory",
        "archived": false,
        "created_at": "2024-07-09T23:41:10+02:00",
        "updated_at": "2024-07-09T23:41:50+02:00",
        "archived_at": "1970-01-01T01:00:00+01:00",
        "permissions": {
          "admin": false,
          "push": false,
          "pull": true
        },
        "has_issues": false,
        "has_wiki": false,
        "has_pull_requests": true,
        "has_projects": false,
        "projects_mode": "all",
        "has_releases": false,
        "has_packages": false,
        "has_actions": false,
        "ignore_whitespace_conflicts": false,
        "allow_merge_commits": true,
        "allow_rebase": true,
        "allow_rebase_explicit": true,
        "allow_squash_merge": true,
        "allow_fast_forward_only_merge": true,
        "allow_rebase_update": true,
        "default_delete_branch_after_merge": false,
        "default_merge_style": "merge",
        "default_allow_maintainer_edit": false,
        "avatar_url": "https://src.opensuse.org/",
        "internal": false,
        "mirror_interval": "",
        "object_format_name": "sha256",
        "mirror_updated": "0001-01-01T00:00:00Z",
        "repo_transfer": null
      }
    },
    "merge_base": "24ee6bee7459a386dadabf8a9f6ae4fa15c3f810bfa01cee5238138aa214d180",
    "due_date": null,
    "created_at": "2024-07-09T23:42:38+02:00",
    "updated_at": "2024-07-09T23:42:38+02:00",
    "closed_at": null,
    "pin_order": 0
  },
  "requested_reviewer": null,
  "repository": {
    "id": 90578,
    "owner": {
      "id": 983,
      "login": "autogits",
      "login_name": "",
      "source_id": 0,
      "full_name": "",
      "email": "",
      "avatar_url": "https://src.opensuse.org/avatars/80a61ef3a14c3c22f0b8b1885d1a75d4",
      "html_url": "https://src.opensuse.org/autogits",
      "language": "",
      "is_admin": false,
      "last_login": "0001-01-01T00:00:00Z",
      "created": "2024-06-20T09:46:37+02:00",
      "restricted": false,
      "active": false,
      "prohibit_login": false,
      "location": "",
      "website": "",
      "description": "",
      "visibility": "public",
      "followers_count": 0,
      "following_count": 0,
      "starred_repos_count": 0,
      "username": "autogits"
    },
    "name": "nodejs21",
    "full_name": "autogits/nodejs21",
    "description": "",
    "empty": false,
    "private": false,
    "fork": true,
    "template": false,
    "parent": {
      "id": 71125,
      "owner": {
        "id": 64,
        "login": "pool",
        "login_name": "",
        "source_id": 0,
        "full_name": "",
        "email": "",
        "avatar_url": "https://src.opensuse.org/avatars/b10a8c0bede9eb4ea771b04db3149f28",
        "html_url": "https://src.opensuse.org/pool",
        "language": "",
        "is_admin": false,
        "last_login": "0001-01-01T00:00:00Z",
        "created": "2023-03-01T14:41:17+01:00",
        "restricted": false,
        "active": false,
        "prohibit_login": false,
        "location": "",
        "website": "",
        "description": "",
        "visibility": "public",
        "followers_count": 0,
        "following_count": 0,
        "starred_repos_count": 0,
        "username": "pool"
      },
      "name": "nodejs21",
      "full_name": "pool/nodejs21",
      "description": "",
      "empty": false,
      "private": false,
      "fork": false,
      "template": false,
      "parent": null,
      "mirror": false,
      "size": 1471,
      "language": "",
      "languages_url": "https://src.opensuse.org/api/v1/repos/pool/nodejs21/languages",
      "html_url": "https://src.opensuse.org/pool/nodejs21",
      "url": "https://src.opensuse.org/api/v1/repos/pool/nodejs21",
      "link": "",
      "ssh_url": "gitea@src.opensuse.org:pool/nodejs21.git",
      "clone_url": "https://src.opensuse.org/pool/nodejs21.git",
      "original_url": "",
      "website": "",
      "stars_count": 0,
      "forks_count": 2,
      "watchers_count": 2,
      "open_issues_count": 0,
      "open_pr_counter": 0,
      "release_counter": 0,
      "default_branch": "factory",
      "archived": false,
      "created_at": "2024-06-17T17:17:37+02:00",
      "updated_at": "2024-06-18T09:03:36+02:00",
      "archived_at": "1970-01-01T01:00:00+01:00",
      "permissions": {
        "admin": true,
        "push": true,
        "pull": true
      },
      "has_issues": true,
      "internal_tracker": {
        "enable_time_tracker": false,
        "allow_only_contributors_to_track_time": true,
        "enable_issue_dependencies": true
      },
      "has_wiki": true,
      "has_pull_requests": true,
      "has_projects": true,
      "projects_mode": "all",
      "has_releases": true,
      "has_packages": true,
      "has_actions": true,
      "ignore_whitespace_conflicts": false,
      "allow_merge_commits": true,
      "allow_rebase": true,
      "allow_rebase_explicit": true,
      "allow_squash_merge": true,
      "allow_fast_forward_only_merge": true,
      "allow_rebase_update": true,
      "default_delete_branch_after_merge": false,
      "default_merge_style": "merge",
      "default_allow_maintainer_edit": false,
      "avatar_url": "https://src.opensuse.org/",
      "internal": false,
      "mirror_interval": "",
      "object_format_name": "sha256",
      "mirror_updated": "0001-01-01T00:00:00Z",
      "repo_transfer": null
    },
    "mirror": false,
    "size": 1471,
    "language": "",
    "languages_url": "https://src.opensuse.org/api/v1/repos/autogits/nodejs21/languages",
    "html_url": "https://src.opensuse.org/autogits/nodejs21",
    "url": "https://src.opensuse.org/api/v1/repos/autogits/nodejs21",
    "link": "",
    "ssh_url": "gitea@src.opensuse.org:autogits/nodejs21.git",
    "clone_url": "https://src.opensuse.org/autogits/nodejs21.git",
    "original_url": "",
    "website": "",
    "stars_count": 0,
    "forks_count": 1,
    "watchers_count": 2,
    "open_issues_count": 0,
    "open_pr_counter": 0,
    "release_counter": 0,
    "default_branch": "factory",
    "archived": false,
    "created_at": "2024-07-09T23:40:35+02:00",
    "updated_at": "2024-07-09T23:40:35+02:00",
    "archived_at": "1970-01-01T01:00:00+01:00",
    "permissions": {
      "admin": true,
      "push": true,
      "pull": true
    },
    "has_issues": false,
    "has_wiki": false,
    "has_pull_requests": true,
    "has_projects": false,
    "projects_mode": "all",
    "has_releases": false,
    "has_packages": false,
    "has_actions": false,
    "ignore_whitespace_conflicts": false,
    "allow_merge_commits": true,
    "allow_rebase": true,
    "allow_rebase_explicit": true,
    "allow_squash_merge": true,
    "allow_fast_forward_only_merge": true,
    "allow_rebase_update": true,
    "default_delete_branch_after_merge": false,
    "default_merge_style": "merge",
    "default_allow_maintainer_edit": false,
    "avatar_url": "https://src.opensuse.org/",
    "internal": false,
    "mirror_interval": "",
    "object_format_name": "sha256",
    "mirror_updated": "0001-01-01T00:00:00Z",
    "repo_transfer": null
  },
  "sender": {
    "id": 129,
    "login": "adamm",
    "login_name": "",
    "source_id": 0,
    "full_name": "Adam Majer",
    "email": "adamm@noreply@src.opensuse.org",
    "avatar_url": "https://src.opensuse.org/avatar/babb6ae054a709c238a4e9b0f2b53d53",
    "html_url": "https://src.opensuse.org/adamm",
    "language": "",
    "is_admin": false,
    "last_login": "0001-01-01T00:00:00Z",
    "created": "2023-07-21T16:43:48+02:00",
    "restricted": false,
    "active": false,
    "prohibit_login": false,
    "location": "",
    "website": "",
    "description": "",
    "visibility": "public",
    "followers_count": 0,
    "following_count": 0,
    "starred_repos_count": 0,
    "username": "adamm"
  },
  "commit_id": "",
  "review": null
}
`

const samplePRsync_JSON=`{
  "action": "synchronized",
  "number": 1,
  "pull_request": {
    "id": 470,
    "url": "https://src.opensuse.org/autogits/_ObsPrj/pulls/1",
    "number": 1,
    "user": {
      "id": 129,
      "login": "adamm",
      "login_name": "",
      "source_id": 0,
      "full_name": "Adam Majer",
      "email": "adamm@noreply@src.opensuse.org",
      "avatar_url": "https://src.opensuse.org/avatar/babb6ae054a709c238a4e9b0f2b53d53",
      "html_url": "https://src.opensuse.org/adamm",
      "language": "",
      "is_admin": false,
      "last_login": "0001-01-01T00:00:00Z",
      "created": "2023-07-21T16:43:48+02:00",
      "restricted": false,
      "active": false,
      "prohibit_login": false,
      "location": "",
      "website": "",
      "description": "",
      "visibility": "public",
      "followers_count": 0,
      "following_count": 0,
      "starred_repos_count": 0,
      "username": "adamm"
    },
    "title": "Forwarded PR: nodejs21",
    "body": "This is a forwarded pull request by GiteaBot - AutoStaging\nreferencing the following pull request:\n\nPullRequest: nodejs21#1\n",
    "labels": [],
    "milestone": null,
    "assignee": null,
    "assignees": null,
    "requested_reviewers": [
      {
        "id": 1008,
        "login": "autogits_obs_staging_bot",
        "login_name": "",
        "source_id": 0,
        "full_name": "Autogits StagingBot",
        "email": "autogits_obs_staging_bot@noreply@src.opensuse.org",
        "avatar_url": "https://src.opensuse.org/avatar/b8f40091fbd0a1f1b9e54f539dcdc783",
        "html_url": "https://src.opensuse.org/autogits_obs_staging_bot",
        "language": "",
        "is_admin": false,
        "last_login": "0001-01-01T00:00:00Z",
        "created": "2024-07-06T14:31:34+02:00",
        "restricted": false,
        "active": false,
        "prohibit_login": false,
        "location": "",
        "website": "",
        "description": "",
        "visibility": "public",
        "followers_count": 0,
        "following_count": 0,
        "starred_repos_count": 0,
        "username": "autogits_obs_staging_bot"
      }
    ],
    "state": "open",
    "draft": false,
    "is_locked": false,
    "comments": 0,
    "review_comments": 0,
    "additions": 1,
    "deletions": 1,
    "changed_files": 1,
    "html_url": "https://src.opensuse.org/autogits/_ObsPrj/pulls/1",
    "diff_url": "https://src.opensuse.org/autogits/_ObsPrj/pulls/1.diff",
    "patch_url": "https://src.opensuse.org/autogits/_ObsPrj/pulls/1.patch",
    "mergeable": false,
    "merged": false,
    "merged_at": null,
    "merge_commit_sha": null,
    "merged_by": null,
    "allow_maintainer_edit": false,
    "base": {
      "label": "main",
      "ref": "main",
      "sha": "b20e37e05f14ba33d39444e297c455d2803998721a4e287099ae7cfb03ea6320",
      "repo_id": 90487,
      "repo": {
        "id": 90487,
        "owner": {
          "id": 983,
          "login": "autogits",
          "login_name": "",
          "source_id": 0,
          "full_name": "",
          "email": "",
          "avatar_url": "https://src.opensuse.org/avatars/80a61ef3a14c3c22f0b8b1885d1a75d4",
          "html_url": "https://src.opensuse.org/autogits",
          "language": "",
          "is_admin": false,
          "last_login": "0001-01-01T00:00:00Z",
          "created": "2024-06-20T09:46:37+02:00",
          "restricted": false,
          "active": false,
          "prohibit_login": false,
          "location": "",
          "website": "",
          "description": "",
          "visibility": "public",
          "followers_count": 0,
          "following_count": 0,
          "starred_repos_count": 0,
          "username": "autogits"
        },
        "name": "_ObsPrj",
        "full_name": "autogits/_ObsPrj",
        "description": "",
        "empty": false,
        "private": false,
        "fork": false,
        "template": false,
        "parent": null,
        "mirror": false,
        "size": 47,
        "language": "",
        "languages_url": "https://src.opensuse.org/api/v1/repos/autogits/_ObsPrj/languages",
        "html_url": "https://src.opensuse.org/autogits/_ObsPrj",
        "url": "https://src.opensuse.org/api/v1/repos/autogits/_ObsPrj",
        "link": "",
        "ssh_url": "gitea@src.opensuse.org:autogits/_ObsPrj.git",
        "clone_url": "https://src.opensuse.org/autogits/_ObsPrj.git",
        "original_url": "",
        "website": "",
        "stars_count": 0,
        "forks_count": 0,
        "watchers_count": 2,
        "open_issues_count": 0,
        "open_pr_counter": 1,
        "release_counter": 0,
        "default_branch": "main",
        "archived": false,
        "created_at": "2024-06-25T13:52:03+02:00",
        "updated_at": "2024-07-10T11:25:22+02:00",
        "archived_at": "1970-01-01T01:00:00+01:00",
        "permissions": {
          "admin": false,
          "push": false,
          "pull": true
        },
        "has_issues": true,
        "internal_tracker": {
          "enable_time_tracker": false,
          "allow_only_contributors_to_track_time": true,
          "enable_issue_dependencies": true
        },
        "has_wiki": true,
        "has_pull_requests": true,
        "has_projects": true,
        "projects_mode": "all",
        "has_releases": true,
        "has_packages": true,
        "has_actions": true,
        "ignore_whitespace_conflicts": false,
        "allow_merge_commits": true,
        "allow_rebase": true,
        "allow_rebase_explicit": true,
        "allow_squash_merge": true,
        "allow_fast_forward_only_merge": true,
        "allow_rebase_update": true,
        "default_delete_branch_after_merge": false,
        "default_merge_style": "merge",
        "default_allow_maintainer_edit": false,
        "avatar_url": "https://src.opensuse.org/",
        "internal": false,
        "mirror_interval": "",
        "object_format_name": "sha256",
        "mirror_updated": "0001-01-01T00:00:00Z",
        "repo_transfer": null
      }
    },
    "head": {
      "label": "PR_nodejs21#1",
      "ref": "PR_nodejs21#1",
      "sha": "3cd37fb6b93c0af07c50c8caa075bbdd1c1202991898ca61482e3cb019a97403",
      "repo_id": 90487,
      "repo": {
        "id": 90487,
        "owner": {
          "id": 983,
          "login": "autogits",
          "login_name": "",
          "source_id": 0,
          "full_name": "",
          "email": "",
          "avatar_url": "https://src.opensuse.org/avatars/80a61ef3a14c3c22f0b8b1885d1a75d4",
          "html_url": "https://src.opensuse.org/autogits",
          "language": "",
          "is_admin": false,
          "last_login": "0001-01-01T00:00:00Z",
          "created": "2024-06-20T09:46:37+02:00",
          "restricted": false,
          "active": false,
          "prohibit_login": false,
          "location": "",
          "website": "",
          "description": "",
          "visibility": "public",
          "followers_count": 0,
          "following_count": 0,
          "starred_repos_count": 0,
          "username": "autogits"
        },
        "name": "_ObsPrj",
        "full_name": "autogits/_ObsPrj",
        "description": "",
        "empty": false,
        "private": false,
        "fork": false,
        "template": false,
        "parent": null,
        "mirror": false,
        "size": 47,
        "language": "",
        "languages_url": "https://src.opensuse.org/api/v1/repos/autogits/_ObsPrj/languages",
        "html_url": "https://src.opensuse.org/autogits/_ObsPrj",
        "url": "https://src.opensuse.org/api/v1/repos/autogits/_ObsPrj",
        "link": "",
        "ssh_url": "gitea@src.opensuse.org:autogits/_ObsPrj.git",
        "clone_url": "https://src.opensuse.org/autogits/_ObsPrj.git",
        "original_url": "",
        "website": "",
        "stars_count": 0,
        "forks_count": 0,
        "watchers_count": 2,
        "open_issues_count": 0,
        "open_pr_counter": 1,
        "release_counter": 0,
        "default_branch": "main",
        "archived": false,
        "created_at": "2024-06-25T13:52:03+02:00",
        "updated_at": "2024-07-10T11:25:22+02:00",
        "archived_at": "1970-01-01T01:00:00+01:00",
        "permissions": {
          "admin": false,
          "push": false,
          "pull": true
        },
        "has_issues": true,
        "internal_tracker": {
          "enable_time_tracker": false,
          "allow_only_contributors_to_track_time": true,
          "enable_issue_dependencies": true
        },
        "has_wiki": true,
        "has_pull_requests": true,
        "has_projects": true,
        "projects_mode": "all",
        "has_releases": true,
        "has_packages": true,
        "has_actions": true,
        "ignore_whitespace_conflicts": false,
        "allow_merge_commits": true,
        "allow_rebase": true,
        "allow_rebase_explicit": true,
        "allow_squash_merge": true,
        "allow_fast_forward_only_merge": true,
        "allow_rebase_update": true,
        "default_delete_branch_after_merge": false,
        "default_merge_style": "merge",
        "default_allow_maintainer_edit": false,
        "avatar_url": "https://src.opensuse.org/",
        "internal": false,
        "mirror_interval": "",
        "object_format_name": "sha256",
        "mirror_updated": "0001-01-01T00:00:00Z",
        "repo_transfer": null
      }
    },
    "merge_base": "b20e37e05f14ba33d39444e297c455d2803998721a4e287099ae7cfb03ea6320",
    "due_date": "0001-01-01T00:53:28+00:53",
    "created_at": "2024-07-10T11:42:27+02:00",
    "updated_at": "2024-07-10T11:42:28+02:00",
    "closed_at": null,
    "pin_order": 0
  },
  "requested_reviewer": null,
  "repository": {
    "id": 90487,
    "owner": {
      "id": 983,
      "login": "autogits",
      "login_name": "",
      "source_id": 0,
      "full_name": "",
      "email": "",
      "avatar_url": "https://src.opensuse.org/avatars/80a61ef3a14c3c22f0b8b1885d1a75d4",
      "html_url": "https://src.opensuse.org/autogits",
      "language": "",
      "is_admin": false,
      "last_login": "0001-01-01T00:00:00Z",
      "created": "2024-06-20T09:46:37+02:00",
      "restricted": false,
      "active": false,
      "prohibit_login": false,
      "location": "",
      "website": "",
      "description": "",
      "visibility": "public",
      "followers_count": 0,
      "following_count": 0,
      "starred_repos_count": 0,
      "username": "autogits"
    },
    "name": "_ObsPrj",
    "full_name": "autogits/_ObsPrj",
    "description": "",
    "empty": false,
    "private": false,
    "fork": false,
    "template": false,
    "parent": null,
    "mirror": false,
    "size": 47,
    "language": "",
    "languages_url": "https://src.opensuse.org/api/v1/repos/autogits/_ObsPrj/languages",
    "html_url": "https://src.opensuse.org/autogits/_ObsPrj",
    "url": "https://src.opensuse.org/api/v1/repos/autogits/_ObsPrj",
    "link": "",
    "ssh_url": "gitea@src.opensuse.org:autogits/_ObsPrj.git",
    "clone_url": "https://src.opensuse.org/autogits/_ObsPrj.git",
    "original_url": "",
    "website": "",
    "stars_count": 0,
    "forks_count": 0,
    "watchers_count": 2,
    "open_issues_count": 0,
    "open_pr_counter": 1,
    "release_counter": 0,
    "default_branch": "main",
    "archived": false,
    "created_at": "2024-06-25T13:52:03+02:00",
    "updated_at": "2024-07-10T11:42:28+02:00",
    "archived_at": "1970-01-01T01:00:00+01:00",
    "permissions": {
      "admin": true,
      "push": true,
      "pull": true
    },
    "has_issues": true,
    "internal_tracker": {
      "enable_time_tracker": false,
      "allow_only_contributors_to_track_time": true,
      "enable_issue_dependencies": true
    },
    "has_wiki": true,
    "has_pull_requests": true,
    "has_projects": true,
    "projects_mode": "all",
    "has_releases": true,
    "has_packages": true,
    "has_actions": true,
    "ignore_whitespace_conflicts": false,
    "allow_merge_commits": true,
    "allow_rebase": true,
    "allow_rebase_explicit": true,
    "allow_squash_merge": true,
    "allow_fast_forward_only_merge": true,
    "allow_rebase_update": true,
    "default_delete_branch_after_merge": false,
    "default_merge_style": "merge",
    "default_allow_maintainer_edit": false,
    "avatar_url": "https://src.opensuse.org/",
    "internal": false,
    "mirror_interval": "",
    "object_format_name": "sha256",
    "mirror_updated": "0001-01-01T00:00:00Z",
    "repo_transfer": null
  },
  "sender": {
    "id": 129,
    "login": "adamm",
    "login_name": "",
    "source_id": 0,
    "full_name": "Adam Majer",
    "email": "adamm@noreply@src.opensuse.org",
    "avatar_url": "https://src.opensuse.org/avatar/babb6ae054a709c238a4e9b0f2b53d53",
    "html_url": "https://src.opensuse.org/adamm",
    "language": "",
    "is_admin": false,
    "last_login": "0001-01-01T00:00:00Z",
    "created": "2023-07-21T16:43:48+02:00",
    "restricted": false,
    "active": false,
    "prohibit_login": false,
    "location": "",
    "website": "",
    "description": "",
    "visibility": "public",
    "followers_count": 0,
    "following_count": 0,
    "starred_repos_count": 0,
    "username": "adamm"
  },
  "commit_id": "",
  "review": null
}
`
