Repository: srvaroa/labeler (go)

Issue:
add condition for draft pull requests
as far as I understand, you can only determine between mergeable true/false, but it would be also nice to check whether it is a draft PR or not.

Pull request description:
Add matcher on draft status
Usage in README.

Fixes #32

Signed-off-by: Galo Navarro <anglorvaroa@gmail.com>


Patch:
diff --git a/README.md b/README.md
index 60b3227..473eb85 100644
--- a/README.md
+++ b/README.md
@@ -154,7 +154,9 @@ With this config, the behaviour changes:
 
 ## Conditions
 
-Below are the conditions currently supported in label matchers.
+Below are the conditions currently supported in label matchers. All conditions
+evaluate only when they are explicitly added in configuration (that is, there
+are no default values).
 
 ### Regex on title
 
@@ -197,14 +199,42 @@ files:
 - "cmd/.*_tests.go"
 ```
 
+### Draft status
+
+This condition is satisfied when the PR [draft
+state](https://developer.github.com/v3/pulls/#response-1) matches that of the
+PR.
+
+```yaml
+draft: true
+```
+
+Matches if the PR is a draft.
+
+```yaml
+draft: false
+```
+
+Matches if the PR is not a draft.
+
 ### Mergeable status
 
-This condition is satisfied when the PR is in a [mergeable state](https://developer.github.com/v3/pulls/#response-1).
+This condition is satisfied when the [mergeable
+state](https://developer.github.com/v3/pulls/#response-1) matches that of the
+PR. 
 
 ```yaml
 mergeable: true
 ```
 
+Will match if the label is mergeable. 
+
+```yaml
+mergeable: false
+```
+
+Will match if the label is not mergeable. 
+
 ### Match to PR Author
 
 This condition is satisfied when the PR author matches any of the given usernames.
diff --git a/action.yml b/action.yml
index 6c818de..0ae67ee 100644
--- a/action.yml
+++ b/action.yml
@@ -1,4 +1,4 @@
-name: 'Configure labels for Pull Requests based on multiple conditions'
+name: 'Manage labels based on multiple conditions'
 description: 'All-in-one action to label Pull Requests based on many, extensible conditional rules'
 author: 'Galo Navarro <anglorvaroa@gmail.com>'
 inputs: 
diff --git a/pkg/condition_isdraft.go b/pkg/condition_isdraft.go
new file mode 100644
index 0000000..2fa5cf5
--- /dev/null
+++ b/pkg/condition_isdraft.go
@@ -0,0 +1,26 @@
+package labeler
+
+import (
+	"fmt"
+	"strconv"
+
+	gh "github.com/google/go-github/v35/github"
+)
+
+func NewIsDraftCondition() Condition {
+	return Condition{
+		GetName: func() string {
+			return "Pull Request is draft"
+		},
+		Evaluate: func(pr *gh.PullRequest, matcher LabelMatcher) (bool, error) {
+			b, err := strconv.ParseBool(matcher.Draft)
+			if err != nil {
+				return false, fmt.Errorf("draft is not set in config")
+			}
+			if b {
+				return pr.GetDraft(), nil
+			}
+			return !pr.GetDraft(), nil
+		},
+	}
+}
diff --git a/pkg/labeler.go b/pkg/labeler.go
index 92b7051..e3acdfc 100644
--- a/pkg/labeler.go
+++ b/pkg/labeler.go
@@ -15,6 +15,7 @@ type LabelMatcher struct {
 	Files      []string
 	Authors    []string
 	Mergeable  string
+	Draft      string
 	SizeBelow  string `yaml:"size-below"`
 	SizeAbove  string `yaml:"size-above"`
 }
@@ -130,6 +131,7 @@ func (l *Labeler) findMatches(pr *gh.PullRequest, config *LabelerConfigV1) (Labe
 		NewBranchCondition(),
 		NewBaseBranchCondition(),
 		NewIsMergeableCondition(),
+		NewIsDraftCondition(),
 		NewSizeCondition(),
 		NewBodyCondition(),
 		NewFilesCondition(l),


Test patch:
diff --git a/pkg/labeler_test.go b/pkg/labeler_test.go
index 6c8c2f0..f124ba9 100644
--- a/pkg/labeler_test.go
+++ b/pkg/labeler_test.go
@@ -133,6 +133,52 @@ func TestHandleEvent(t *testing.T) {
 			initialLabels:  []string{},
 			expectedLabels: []string{"WIP"},
 		},
+		{
+			payloads: []string{"create_pr", "create_draft_pr"},
+			name:     "Draft PR without explicit value is not evaluated",
+			config: LabelerConfigV1{
+				Version: 1,
+				Labels: []LabelMatcher{
+					{
+						Label: "NotADraft",
+					},
+				},
+			},
+			initialLabels:  []string{},
+			expectedLabels: []string{},
+		},
+		{
+			payloads: []string{"create_pr"},
+			name:     "Non draft PR with explicit config is evaluated",
+			config: LabelerConfigV1{
+				Version: 1,
+				Labels: []LabelMatcher{
+					{
+						Label: "NotADraft",
+						Draft: "False",
+					},
+				},
+			},
+			initialLabels:  []string{},
+			expectedLabels: []string{"NotADraft"},
+		},
+
+		{
+			payloads: []string{"create_draft_pr"},
+			name:     "Draft PR",
+			config: LabelerConfigV1{
+				Version: 1,
+				Labels: []LabelMatcher{
+					{
+						Label: "ThisIsADraft",
+						Draft: "True",
+					},
+				},
+			},
+			initialLabels:  []string{},
+			expectedLabels: []string{"ThisIsADraft"},
+		},
+
 		{
 			payloads: []string{"create_pr", "reopen_pr"},
 			name:     "Add a label with two conditions, one not matching (1)",
@@ -362,7 +408,7 @@ func TestHandleEvent(t *testing.T) {
 			payloads: []string{"create_pr", "reopen_pr"},
 			name:     "AppendOnly enabled forbids deletions",
 			config: LabelerConfigV1{
-				Version:          1,
+				Version:    1,
 				AppendOnly: true,
 				Labels: []LabelMatcher{
 					{
diff --git a/test_data/create_draft_pr_payload b/test_data/create_draft_pr_payload
new file mode 100644
index 0000000..22bde9d
--- /dev/null
+++ b/test_data/create_draft_pr_payload
@@ -0,0 +1,502 @@
+{
+  "action": "opened",
+  "number": 2,
+  "pull_request": {
+    "url": "https://api.github.com/repos/srvaroa/test/pulls/2",
+    "id": 1238110216,
+    "node_id": "PR_kwDODfGd5c5JzBAI",
+    "html_url": "https://github.com/srvaroa/test/pull/2",
+    "diff_url": "https://github.com/srvaroa/test/pull/2.diff",
+    "patch_url": "https://github.com/srvaroa/test/pull/2.patch",
+    "issue_url": "https://api.github.com/repos/srvaroa/test/issues/2",
+    "number": 2,
+    "state": "open",
+    "locked": false,
+    "title": "WIP: customer model",
+    "user": {
+      "login": "srvaroa",
+      "id": 346110,
+      "node_id": "MDQ6VXNlcjM0NjExMA==",
+      "avatar_url": "https://avatars.githubusercontent.com/u/346110?v=4",
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/srvaroa",
+      "html_url": "https://github.com/srvaroa",
+      "followers_url": "https://api.github.com/users/srvaroa/followers",
+      "following_url": "https://api.github.com/users/srvaroa/following{/other_user}",
+      "gists_url": "https://api.github.com/users/srvaroa/gists{/gist_id}",
+      "starred_url": "https://api.github.com/users/srvaroa/starred{/owner}{/repo}",
+      "subscriptions_url": "https://api.github.com/users/srvaroa/subscriptions",
+      "organizations_url": "https://api.github.com/users/srvaroa/orgs",
+      "repos_url": "https://api.github.com/users/srvaroa/repos",
+      "events_url": "https://api.github.com/users/srvaroa/events{/privacy}",
+      "received_events_url": "https://api.github.com/users/srvaroa/received_events",
+      "type": "User",
+      "site_admin": false
+    },
+    "body": "Signed-off-by: Galo Navarro <anglorvaroa@gmail.com>",
+    "created_at": "2023-02-12T17:11:11Z",
+    "updated_at": "2023-02-12T17:11:11Z",
+    "closed_at": null,
+    "merged_at": null,
+    "merge_commit_sha": null,
+    "assignee": null,
+    "assignees": [
+
+    ],
+    "requested_reviewers": [
+
+    ],
+    "requested_teams": [
+
+    ],
+    "labels": [
+
+    ],
+    "milestone": null,
+    "draft": true,
+    "commits_url": "https://api.github.com/repos/srvaroa/test/pulls/2/commits",
+    "review_comments_url": "https://api.github.com/repos/srvaroa/test/pulls/2/comments",
+    "review_comment_url": "https://api.github.com/repos/srvaroa/test/pulls/comments{/number}",
+    "comments_url": "https://api.github.com/repos/srvaroa/test/issues/2/comments",
+    "statuses_url": "https://api.github.com/repos/srvaroa/test/statuses/6f1da8f1a57f7054b221f023784bca73dfc85b00",
+    "head": {
+      "label": "srvaroa:master-old",
+      "ref": "master-old",
+      "sha": "6f1da8f1a57f7054b221f023784bca73dfc85b00",
+      "user": {
+        "login": "srvaroa",
+        "id": 346110,
+        "node_id": "MDQ6VXNlcjM0NjExMA==",
+        "avatar_url": "https://avatars.githubusercontent.com/u/346110?v=4",
+        "gravatar_id": "",
+        "url": "https://api.github.com/users/srvaroa",
+        "html_url": "https://github.com/srvaroa",
+        "followers_url": "https://api.github.com/users/srvaroa/followers",
+        "following_url": "https://api.github.com/users/srvaroa/following{/other_user}",
+        "gists_url": "https://api.github.com/users/srvaroa/gists{/gist_id}",
+        "starred_url": "https://api.github.com/users/srvaroa/starred{/owner}{/repo}",
+        "subscriptions_url": "https://api.github.com/users/srvaroa/subscriptions",
+        "organizations_url": "https://api.github.com/users/srvaroa/orgs",
+        "repos_url": "https://api.github.com/users/srvaroa/repos",
+        "events_url": "https://api.github.com/users/srvaroa/events{/privacy}",
+        "received_events_url": "https://api.github.com/users/srvaroa/received_events",
+        "type": "User",
+        "site_admin": false
+      },
+      "repo": {
+        "id": 233938405,
+        "node_id": "MDEwOlJlcG9zaXRvcnkyMzM5Mzg0MDU=",
+        "name": "test",
+        "full_name": "srvaroa/test",
+        "private": true,
+        "owner": {
+          "login": "srvaroa",
+          "id": 346110,
+          "node_id": "MDQ6VXNlcjM0NjExMA==",
+          "avatar_url": "https://avatars.githubusercontent.com/u/346110?v=4",
+          "gravatar_id": "",
+          "url": "https://api.github.com/users/srvaroa",
+          "html_url": "https://github.com/srvaroa",
+          "followers_url": "https://api.github.com/users/srvaroa/followers",
+          "following_url": "https://api.github.com/users/srvaroa/following{/other_user}",
+          "gists_url": "https://api.github.com/users/srvaroa/gists{/gist_id}",
+          "starred_url": "https://api.github.com/users/srvaroa/starred{/owner}{/repo}",
+          "subscriptions_url": "https://api.github.com/users/srvaroa/subscriptions",
+          "organizations_url": "https://api.github.com/users/srvaroa/orgs",
+          "repos_url": "https://api.github.com/users/srvaroa/repos",
+          "events_url": "https://api.github.com/users/srvaroa/events{/privacy}",
+          "received_events_url": "https://api.github.com/users/srvaroa/received_events",
+          "type": "User",
+          "site_admin": false
+        },
+        "html_url": "https://github.com/srvaroa/test",
+        "description": null,
+        "fork": false,
+        "url": "https://api.github.com/repos/srvaroa/test",
+        "forks_url": "https://api.github.com/repos/srvaroa/test/forks",
+        "keys_url": "https://api.github.com/repos/srvaroa/test/keys{/key_id}",
+        "collaborators_url": "https://api.github.com/repos/srvaroa/test/collaborators{/collaborator}",
+        "teams_url": "https://api.github.com/repos/srvaroa/test/teams",
+        "hooks_url": "https://api.github.com/repos/srvaroa/test/hooks",
+        "issue_events_url": "https://api.github.com/repos/srvaroa/test/issues/events{/number}",
+        "events_url": "https://api.github.com/repos/srvaroa/test/events",
+        "assignees_url": "https://api.github.com/repos/srvaroa/test/assignees{/user}",
+        "branches_url": "https://api.github.com/repos/srvaroa/test/branches{/branch}",
+        "tags_url": "https://api.github.com/repos/srvaroa/test/tags",
+        "blobs_url": "https://api.github.com/repos/srvaroa/test/git/blobs{/sha}",
+        "git_tags_url": "https://api.github.com/repos/srvaroa/test/git/tags{/sha}",
+        "git_refs_url": "https://api.github.com/repos/srvaroa/test/git/refs{/sha}",
+        "trees_url": "https://api.github.com/repos/srvaroa/test/git/trees{/sha}",
+        "statuses_url": "https://api.github.com/repos/srvaroa/test/statuses/{sha}",
+        "languages_url": "https://api.github.com/repos/srvaroa/test/languages",
+        "stargazers_url": "https://api.github.com/repos/srvaroa/test/stargazers",
+        "contributors_url": "https://api.github.com/repos/srvaroa/test/contributors",
+        "subscribers_url": "https://api.github.com/repos/srvaroa/test/subscribers",
+        "subscription_url": "https://api.github.com/repos/srvaroa/test/subscription",
+        "commits_url": "https://api.github.com/repos/srvaroa/test/commits{/sha}",
+        "git_commits_url": "https://api.github.com/repos/srvaroa/test/git/commits{/sha}",
+        "comments_url": "https://api.github.com/repos/srvaroa/test/comments{/number}",
+        "issue_comment_url": "https://api.github.com/repos/srvaroa/test/issues/comments{/number}",
+        "contents_url": "https://api.github.com/repos/srvaroa/test/contents/{+path}",
+        "compare_url": "https://api.github.com/repos/srvaroa/test/compare/{base}...{head}",
+        "merges_url": "https://api.github.com/repos/srvaroa/test/merges",
+        "archive_url": "https://api.github.com/repos/srvaroa/test/{archive_format}{/ref}",
+        "downloads_url": "https://api.github.com/repos/srvaroa/test/downloads",
+        "issues_url": "https://api.github.com/repos/srvaroa/test/issues{/number}",
+        "pulls_url": "https://api.github.com/repos/srvaroa/test/pulls{/number}",
+        "milestones_url": "https://api.github.com/repos/srvaroa/test/milestones{/number}",
+        "notifications_url": "https://api.github.com/repos/srvaroa/test/notifications{?since,all,participating}",
+        "labels_url": "https://api.github.com/repos/srvaroa/test/labels{/name}",
+        "releases_url": "https://api.github.com/repos/srvaroa/test/releases{/id}",
+        "deployments_url": "https://api.github.com/repos/srvaroa/test/deployments",
+        "created_at": "2020-01-14T21:22:11Z",
+        "updated_at": "2020-03-02T22:27:53Z",
+        "pushed_at": "2023-02-12T17:11:11Z",
+        "git_url": "git://github.com/srvaroa/test.git",
+        "ssh_url": "git@github.com:srvaroa/test.git",
+        "clone_url": "https://github.com/srvaroa/test.git",
+        "svn_url": "https://github.com/srvaroa/test",
+        "homepage": null,
+        "size": 42,
+        "stargazers_count": 0,
+        "watchers_count": 0,
+        "language": "Go",
+        "has_issues": true,
+        "has_projects": true,
+        "has_downloads": true,
+        "has_wiki": true,
+        "has_pages": false,
+        "has_discussions": false,
+        "forks_count": 0,
+        "mirror_url": null,
+        "archived": false,
+        "disabled": false,
+        "open_issues_count": 2,
+        "license": null,
+        "allow_forking": true,
+        "is_template": false,
+        "web_commit_signoff_required": false,
+        "topics": [
+
+        ],
+        "visibility": "private",
+        "forks": 0,
+        "open_issues": 2,
+        "watchers": 0,
+        "default_branch": "master",
+        "allow_squash_merge": true,
+        "allow_merge_commit": true,
+        "allow_rebase_merge": true,
+        "allow_auto_merge": false,
+        "delete_branch_on_merge": false,
+        "allow_update_branch": false,
+        "use_squash_pr_title_as_default": false,
+        "squash_merge_commit_message": "COMMIT_MESSAGES",
+        "squash_merge_commit_title": "COMMIT_OR_PR_TITLE",
+        "merge_commit_message": "PR_TITLE",
+        "merge_commit_title": "MERGE_MESSAGE"
+      }
+    },
+    "base": {
+      "label": "srvaroa:master",
+      "ref": "master",
+      "sha": "8486f9a4796ed6e5b9c8206bf6f12e12a6de623e",
+      "user": {
+        "login": "srvaroa",
+        "id": 346110,
+        "node_id": "MDQ6VXNlcjM0NjExMA==",
+        "avatar_url": "https://avatars.githubusercontent.com/u/346110?v=4",
+        "gravatar_id": "",
+        "url": "https://api.github.com/users/srvaroa",
+        "html_url": "https://github.com/srvaroa",
+        "followers_url": "https://api.github.com/users/srvaroa/followers",
+        "following_url": "https://api.github.com/users/srvaroa/following{/other_user}",
+        "gists_url": "https://api.github.com/users/srvaroa/gists{/gist_id}",
+        "starred_url": "https://api.github.com/users/srvaroa/starred{/owner}{/repo}",
+        "subscriptions_url": "https://api.github.com/users/srvaroa/subscriptions",
+        "organizations_url": "https://api.github.com/users/srvaroa/orgs",
+        "repos_url": "https://api.github.com/users/srvaroa/repos",
+        "events_url": "https://api.github.com/users/srvaroa/events{/privacy}",
+        "received_events_url": "https://api.github.com/users/srvaroa/received_events",
+        "type": "User",
+        "site_admin": false
+      },
+      "repo": {
+        "id": 233938405,
+        "node_id": "MDEwOlJlcG9zaXRvcnkyMzM5Mzg0MDU=",
+        "name": "test",
+        "full_name": "srvaroa/test",
+        "private": true,
+        "owner": {
+          "login": "srvaroa",
+          "id": 346110,
+          "node_id": "MDQ6VXNlcjM0NjExMA==",
+          "avatar_url": "https://avatars.githubusercontent.com/u/346110?v=4",
+          "gravatar_id": "",
+          "url": "https://api.github.com/users/srvaroa",
+          "html_url": "https://github.com/srvaroa",
+          "followers_url": "https://api.github.com/users/srvaroa/followers",
+          "following_url": "https://api.github.com/users/srvaroa/following{/other_user}",
+          "gists_url": "https://api.github.com/users/srvaroa/gists{/gist_id}",
+          "starred_url": "https://api.github.com/users/srvaroa/starred{/owner}{/repo}",
+          "subscriptions_url": "https://api.github.com/users/srvaroa/subscriptions",
+          "organizations_url": "https://api.github.com/users/srvaroa/orgs",
+          "repos_url": "https://api.github.com/users/srvaroa/repos",
+          "events_url": "https://api.github.com/users/srvaroa/events{/privacy}",
+          "received_events_url": "https://api.github.com/users/srvaroa/received_events",
+          "type": "User",
+          "site_admin": false
+        },
+        "html_url": "https://github.com/srvaroa/test",
+        "description": null,
+        "fork": false,
+        "url": "https://api.github.com/repos/srvaroa/test",
+        "forks_url": "https://api.github.com/repos/srvaroa/test/forks",
+        "keys_url": "https://api.github.com/repos/srvaroa/test/keys{/key_id}",
+        "collaborators_url": "https://api.github.com/repos/srvaroa/test/collaborators{/collaborator}",
+        "teams_url": "https://api.github.com/repos/srvaroa/test/teams",
+        "hooks_url": "https://api.github.com/repos/srvaroa/test/hooks",
+        "issue_events_url": "https://api.github.com/repos/srvaroa/test/issues/events{/number}",
+        "events_url": "https://api.github.com/repos/srvaroa/test/events",
+        "assignees_url": "https://api.github.com/repos/srvaroa/test/assignees{/user}",
+        "branches_url": "https://api.github.com/repos/srvaroa/test/branches{/branch}",
+        "tags_url": "https://api.github.com/repos/srvaroa/test/tags",
+        "blobs_url": "https://api.github.com/repos/srvaroa/test/git/blobs{/sha}",
+        "git_tags_url": "https://api.github.com/repos/srvaroa/test/git/tags{/sha}",
+        "git_refs_url": "https://api.github.com/repos/srvaroa/test/git/refs{/sha}",
+        "trees_url": "https://api.github.com/repos/srvaroa/test/git/trees{/sha}",
+        "statuses_url": "https://api.github.com/repos/srvaroa/test/statuses/{sha}",
+        "languages_url": "https://api.github.com/repos/srvaroa/test/languages",
+        "stargazers_url": "https://api.github.com/repos/srvaroa/test/stargazers",
+        "contributors_url": "https://api.github.com/repos/srvaroa/test/contributors",
+        "subscribers_url": "https://api.github.com/repos/srvaroa/test/subscribers",
+        "subscription_url": "https://api.github.com/repos/srvaroa/test/subscription",
+        "commits_url": "https://api.github.com/repos/srvaroa/test/commits{/sha}",
+        "git_commits_url": "https://api.github.com/repos/srvaroa/test/git/commits{/sha}",
+        "comments_url": "https://api.github.com/repos/srvaroa/test/comments{/number}",
+        "issue_comment_url": "https://api.github.com/repos/srvaroa/test/issues/comments{/number}",
+        "contents_url": "https://api.github.com/repos/srvaroa/test/contents/{+path}",
+        "compare_url": "https://api.github.com/repos/srvaroa/test/compare/{base}...{head}",
+        "merges_url": "https://api.github.com/repos/srvaroa/test/merges",
+        "archive_url": "https://api.github.com/repos/srvaroa/test/{archive_format}{/ref}",
+        "downloads_url": "https://api.github.com/repos/srvaroa/test/downloads",
+        "issues_url": "https://api.github.com/repos/srvaroa/test/issues{/number}",
+        "pulls_url": "https://api.github.com/repos/srvaroa/test/pulls{/number}",
+        "milestones_url": "https://api.github.com/repos/srvaroa/test/milestones{/number}",
+        "notifications_url": "https://api.github.com/repos/srvaroa/test/notifications{?since,all,participating}",
+        "labels_url": "https://api.github.com/repos/srvaroa/test/labels{/name}",
+        "releases_url": "https://api.github.com/repos/srvaroa/test/releases{/id}",
+        "deployments_url": "https://api.github.com/repos/srvaroa/test/deployments",
+        "created_at": "2020-01-14T21:22:11Z",
+        "updated_at": "2020-03-02T22:27:53Z",
+        "pushed_at": "2023-02-12T17:11:11Z",
+        "git_url": "git://github.com/srvaroa/test.git",
+        "ssh_url": "git@github.com:srvaroa/test.git",
+        "clone_url": "https://github.com/srvaroa/test.git",
+        "svn_url": "https://github.com/srvaroa/test",
+        "homepage": null,
+        "size": 42,
+        "stargazers_count": 0,
+        "watchers_count": 0,
+        "language": "Go",
+        "has_issues": true,
+        "has_projects": true,
+        "has_downloads": true,
+        "has_wiki": true,
+        "has_pages": false,
+        "has_discussions": false,
+        "forks_count": 0,
+        "mirror_url": null,
+        "archived": false,
+        "disabled": false,
+        "open_issues_count": 2,
+        "license": null,
+        "allow_forking": true,
+        "is_template": false,
+        "web_commit_signoff_required": false,
+        "topics": [
+
+        ],
+        "visibility": "private",
+        "forks": 0,
+        "open_issues": 2,
+        "watchers": 0,
+        "default_branch": "master",
+        "allow_squash_merge": true,
+        "allow_merge_commit": true,
+        "allow_rebase_merge": true,
+        "allow_auto_merge": false,
+        "delete_branch_on_merge": false,
+        "allow_update_branch": false,
+        "use_squash_pr_title_as_default": false,
+        "squash_merge_commit_message": "COMMIT_MESSAGES",
+        "squash_merge_commit_title": "COMMIT_OR_PR_TITLE",
+        "merge_commit_message": "PR_TITLE",
+        "merge_commit_title": "MERGE_MESSAGE"
+      }
+    },
+    "_links": {
+      "self": {
+        "href": "https://api.github.com/repos/srvaroa/test/pulls/2"
+      },
+      "html": {
+        "href": "https://github.com/srvaroa/test/pull/2"
+      },
+      "issue": {
+        "href": "https://api.github.com/repos/srvaroa/test/issues/2"
+      },
+      "comments": {
+        "href": "https://api.github.com/repos/srvaroa/test/issues/2/comments"
+      },
+      "review_comments": {
+        "href": "https://api.github.com/repos/srvaroa/test/pulls/2/comments"
+      },
+      "review_comment": {
+        "href": "https://api.github.com/repos/srvaroa/test/pulls/comments{/number}"
+      },
+      "commits": {
+        "href": "https://api.github.com/repos/srvaroa/test/pulls/2/commits"
+      },
+      "statuses": {
+        "href": "https://api.github.com/repos/srvaroa/test/statuses/6f1da8f1a57f7054b221f023784bca73dfc85b00"
+      }
+    },
+    "author_association": "OWNER",
+    "auto_merge": null,
+    "active_lock_reason": null,
+    "merged": false,
+    "mergeable": null,
+    "rebaseable": null,
+    "mergeable_state": "unknown",
+    "merged_by": null,
+    "comments": 0,
+    "review_comments": 0,
+    "maintainer_can_modify": false,
+    "commits": 1,
+    "additions": 76,
+    "deletions": 14,
+    "changed_files": 2
+  },
+  "repository": {
+    "id": 233938405,
+    "node_id": "MDEwOlJlcG9zaXRvcnkyMzM5Mzg0MDU=",
+    "name": "test",
+    "full_name": "srvaroa/test",
+    "private": true,
+    "owner": {
+      "login": "srvaroa",
+      "id": 346110,
+      "node_id": "MDQ6VXNlcjM0NjExMA==",
+      "avatar_url": "https://avatars.githubusercontent.com/u/346110?v=4",
+      "gravatar_id": "",
+      "url": "https://api.github.com/users/srvaroa",
+      "html_url": "https://github.com/srvaroa",
+      "followers_url": "https://api.github.com/users/srvaroa/followers",
+      "following_url": "https://api.github.com/users/srvaroa/following{/other_user}",
+      "gists_url": "https://api.github.com/users/srvaroa/gists{/gist_id}",
+      "starred_url": "https://api.github.com/users/srvaroa/starred{/owner}{/repo}",
+      "subscriptions_url": "https://api.github.com/users/srvaroa/subscriptions",
+      "organizations_url": "https://api.github.com/users/srvaroa/orgs",
+      "repos_url": "https://api.github.com/users/srvaroa/repos",
+      "events_url": "https://api.github.com/users/srvaroa/events{/privacy}",
+      "received_events_url": "https://api.github.com/users/srvaroa/received_events",
+      "type": "User",
+      "site_admin": false
+    },
+    "html_url": "https://github.com/srvaroa/test",
+    "description": null,
+    "fork": false,
+    "url": "https://api.github.com/repos/srvaroa/test",
+    "forks_url": "https://api.github.com/repos/srvaroa/test/forks",
+    "keys_url": "https://api.github.com/repos/srvaroa/test/keys{/key_id}",
+    "collaborators_url": "https://api.github.com/repos/srvaroa/test/collaborators{/collaborator}",
+    "teams_url": "https://api.github.com/repos/srvaroa/test/teams",
+    "hooks_url": "https://api.github.com/repos/srvaroa/test/hooks",
+    "issue_events_url": "https://api.github.com/repos/srvaroa/test/issues/events{/number}",
+    "events_url": "https://api.github.com/repos/srvaroa/test/events",
+    "assignees_url": "https://api.github.com/repos/srvaroa/test/assignees{/user}",
+    "branches_url": "https://api.github.com/repos/srvaroa/test/branches{/branch}",
+    "tags_url": "https://api.github.com/repos/srvaroa/test/tags",
+    "blobs_url": "https://api.github.com/repos/srvaroa/test/git/blobs{/sha}",
+    "git_tags_url": "https://api.github.com/repos/srvaroa/test/git/tags{/sha}",
+    "git_refs_url": "https://api.github.com/repos/srvaroa/test/git/refs{/sha}",
+    "trees_url": "https://api.github.com/repos/srvaroa/test/git/trees{/sha}",
+    "statuses_url": "https://api.github.com/repos/srvaroa/test/statuses/{sha}",
+    "languages_url": "https://api.github.com/repos/srvaroa/test/languages",
+    "stargazers_url": "https://api.github.com/repos/srvaroa/test/stargazers",
+    "contributors_url": "https://api.github.com/repos/srvaroa/test/contributors",
+    "subscribers_url": "https://api.github.com/repos/srvaroa/test/subscribers",
+    "subscription_url": "https://api.github.com/repos/srvaroa/test/subscription",
+    "commits_url": "https://api.github.com/repos/srvaroa/test/commits{/sha}",
+    "git_commits_url": "https://api.github.com/repos/srvaroa/test/git/commits{/sha}",
+    "comments_url": "https://api.github.com/repos/srvaroa/test/comments{/number}",
+    "issue_comment_url": "https://api.github.com/repos/srvaroa/test/issues/comments{/number}",
+    "contents_url": "https://api.github.com/repos/srvaroa/test/contents/{+path}",
+    "compare_url": "https://api.github.com/repos/srvaroa/test/compare/{base}...{head}",
+    "merges_url": "https://api.github.com/repos/srvaroa/test/merges",
+    "archive_url": "https://api.github.com/repos/srvaroa/test/{archive_format}{/ref}",
+    "downloads_url": "https://api.github.com/repos/srvaroa/test/downloads",
+    "issues_url": "https://api.github.com/repos/srvaroa/test/issues{/number}",
+    "pulls_url": "https://api.github.com/repos/srvaroa/test/pulls{/number}",
+    "milestones_url": "https://api.github.com/repos/srvaroa/test/milestones{/number}",
+    "notifications_url": "https://api.github.com/repos/srvaroa/test/notifications{?since,all,participating}",
+    "labels_url": "https://api.github.com/repos/srvaroa/test/labels{/name}",
+    "releases_url": "https://api.github.com/repos/srvaroa/test/releases{/id}",
+    "deployments_url": "https://api.github.com/repos/srvaroa/test/deployments",
+    "created_at": "2020-01-14T21:22:11Z",
+    "updated_at": "2020-03-02T22:27:53Z",
+    "pushed_at": "2023-02-12T17:11:11Z",
+    "git_url": "git://github.com/srvaroa/test.git",
+    "ssh_url": "git@github.com:srvaroa/test.git",
+    "clone_url": "https://github.com/srvaroa/test.git",
+    "svn_url": "https://github.com/srvaroa/test",
+    "homepage": null,
+    "size": 42,
+    "stargazers_count": 0,
+    "watchers_count": 0,
+    "language": "Go",
+    "has_issues": true,
+    "has_projects": true,
+    "has_downloads": true,
+    "has_wiki": true,
+    "has_pages": false,
+    "has_discussions": false,
+    "forks_count": 0,
+    "mirror_url": null,
+    "archived": false,
+    "disabled": false,
+    "open_issues_count": 2,
+    "license": null,
+    "allow_forking": true,
+    "is_template": false,
+    "web_commit_signoff_required": false,
+    "topics": [
+
+    ],
+    "visibility": "private",
+    "forks": 0,
+    "open_issues": 2,
+    "watchers": 0,
+    "default_branch": "master"
+  },
+  "sender": {
+    "login": "srvaroa",
+    "id": 346110,
+    "node_id": "MDQ6VXNlcjM0NjExMA==",
+    "avatar_url": "https://avatars.githubusercontent.com/u/346110?v=4",
+    "gravatar_id": "",
+    "url": "https://api.github.com/users/srvaroa",
+    "html_url": "https://github.com/srvaroa",
+    "followers_url": "https://api.github.com/users/srvaroa/followers",
+    "following_url": "https://api.github.com/users/srvaroa/following{/other_user}",
+    "gists_url": "https://api.github.com/users/srvaroa/gists{/gist_id}",
+    "starred_url": "https://api.github.com/users/srvaroa/starred{/owner}{/repo}",
+    "subscriptions_url": "https://api.github.com/users/srvaroa/subscriptions",
+    "organizations_url": "https://api.github.com/users/srvaroa/orgs",
+    "repos_url": "https://api.github.com/users/srvaroa/repos",
+    "events_url": "https://api.github.com/users/srvaroa/events{/privacy}",
+    "received_events_url": "https://api.github.com/users/srvaroa/received_events",
+    "type": "User",
+    "site_admin": false
+  }
+}