diff --git a/.changeset/metal-squids-travel.md b/.changeset/metal-squids-travel.md new file mode 100644 index 00000000..bbbe8e74 --- /dev/null +++ b/.changeset/metal-squids-travel.md @@ -0,0 +1,5 @@ +--- +'grafana-github-datasource': minor +--- + +Feature: Add labels to Pull Requests query type diff --git a/pkg/github/pull_requests.go b/pkg/github/pull_requests.go index 22234dc2..9e4968da 100644 --- a/pkg/github/pull_requests.go +++ b/pkg/github/pull_requests.go @@ -2,6 +2,7 @@ package github import ( "context" + "encoding/json" "fmt" "strings" "time" @@ -56,6 +57,11 @@ type PullRequest struct { MergedAt githubv4.DateTime Mergeable githubv4.MergeableState MergedBy *PullRequestAuthor + Labels struct { + Nodes []struct { + Name string + } + } `graphql:"labels(first: 100)"` Repository Repository } @@ -96,6 +102,7 @@ func (p PullRequests) Frames() data.Frames { data.NewField("updated_at", nil, []time.Time{}), data.NewField("created_at", nil, []time.Time{}), openTime, + data.NewField("labels", nil, []json.RawMessage{}), ) for _, v := range p { @@ -150,6 +157,14 @@ func (p PullRequests) Frames() data.Frames { } } + labels := make([]string, len(v.Labels.Nodes)) + for i, label := range v.Labels.Nodes { + labels[i] = label.Name + } + + labelsBytes, _ := json.Marshal(labels) + rawLabelArray := json.RawMessage(labelsBytes) + frame.AppendRow( v.Number, v.Title, @@ -176,6 +191,7 @@ func (p PullRequests) Frames() data.Frames { v.UpdatedAt.Time, v.CreatedAt.Time, secondsOpen, + rawLabelArray, ) } diff --git a/pkg/github/pull_requests_test.go b/pkg/github/pull_requests_test.go index 135fe8ff..5d6a913f 100644 --- a/pkg/github/pull_requests_test.go +++ b/pkg/github/pull_requests_test.go @@ -86,6 +86,14 @@ func TestPullRequestsDataFrame(t *testing.T) { }, Mergeable: githubv4.MergeableStateMergeable, MergedBy: nil, + Labels: struct { + Nodes []struct{ Name string } + }{ + Nodes: []struct{ Name string }{ + {Name: "bug"}, + {Name: "enhancement"}, + }, + }, }, { Number: 2, @@ -118,6 +126,13 @@ func TestPullRequestsDataFrame(t *testing.T) { MergedBy: &PullRequestAuthor{ User: firstUser, }, + Labels: struct { + Nodes []struct{ Name string } + }{ + Nodes: []struct{ Name string }{ + {Name: "documentation"}, + }, + }, }, { Number: 3, @@ -145,6 +160,11 @@ func TestPullRequestsDataFrame(t *testing.T) { Time: openedAt.Add(time.Hour * 2), }, Mergeable: githubv4.MergeableStateMergeable, + Labels: struct { + Nodes []struct{ Name string } + }{ + Nodes: []struct{ Name string }{}, + }, }, } diff --git a/pkg/github/testdata/commits.golden.jsonc b/pkg/github/testdata/commits.golden.jsonc index f341b555..6bfcce5c 100644 --- a/pkg/github/testdata/commits.golden.jsonc +++ b/pkg/github/testdata/commits.golden.jsonc @@ -3,14 +3,14 @@ // Frame[0] // Name: commits // Dimensions: 8 Fields by 2 Rows -// +----------------+-----------------+--------------------+--------------------+----------------------+---------------------------------+---------------------------------+----------------+ -// | Name: id | Name: author | Name: author_login | Name: author_email | Name: author_company | Name: committed_at | Name: pushed_at | Name: message | -// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | -// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []time.Time | Type: []time.Time | Type: []string | -// +----------------+-----------------+--------------------+--------------------+----------------------+---------------------------------+---------------------------------+----------------+ -// | | firstCommitter | firstCommitter | first@example.com | ACME Corp | 2020-08-25 16:21:56 +0000 +0000 | 2020-08-25 16:23:56 +0000 +0000 | commit #1 | -// | | secondCommitter | secondCommitter | second@example.com | ACME Corp | 2020-08-25 17:21:56 +0000 +0000 | 2020-08-25 18:21:56 +0000 +0000 | commit #2 | -// +----------------+-----------------+--------------------+--------------------+----------------------+---------------------------------+---------------------------------+----------------+ +// +----------------+-----------------+--------------------+--------------------+----------------------+-------------------------------+-------------------------------+----------------+ +// | Name: id | Name: author | Name: author_login | Name: author_email | Name: author_company | Name: committed_at | Name: pushed_at | Name: message | +// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | +// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []time.Time | Type: []time.Time | Type: []string | +// +----------------+-----------------+--------------------+--------------------+----------------------+-------------------------------+-------------------------------+----------------+ +// | | firstCommitter | firstCommitter | first@example.com | ACME Corp | 2020-08-25 16:21:56 +0000 UTC | 2020-08-25 16:23:56 +0000 UTC | commit #1 | +// | | secondCommitter | secondCommitter | second@example.com | ACME Corp | 2020-08-25 17:21:56 +0000 UTC | 2020-08-25 18:21:56 +0000 UTC | commit #2 | +// +----------------+-----------------+--------------------+--------------------+----------------------+-------------------------------+-------------------------------+----------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/github/testdata/issues.golden.jsonc b/pkg/github/testdata/issues.golden.jsonc index c652263d..1dc3671a 100644 --- a/pkg/github/testdata/issues.golden.jsonc +++ b/pkg/github/testdata/issues.golden.jsonc @@ -3,15 +3,15 @@ // Frame[0] // Name: issues // Dimensions: 11 Fields by 3 Rows -// +----------------+----------------+----------------------+-----------------+---------------+--------------+---------------------------------+---------------------------------+---------------------------------+-------------------------+----------------------------+ -// | Name: title | Name: author | Name: author_company | Name: repo | Name: number | Name: closed | Name: created_at | Name: closed_at | Name: updated_at | Name: labels | Name: assignees | -// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | -// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []int64 | Type: []bool | Type: []time.Time | Type: []*time.Time | Type: []time.Time | Type: []json.RawMessage | Type: []json.RawMessage | -// +----------------+----------------+----------------------+-----------------+---------------+--------------+---------------------------------+---------------------------------+---------------------------------+-------------------------+----------------------------+ -// | Issue #1 | firstUser | ACME Corp | grafana/grafana | 1 | false | 2020-08-25 16:21:56 +0000 +0000 | null | 2020-08-25 16:21:56 +0000 +0000 | ["bug","help wanted"] | ["firstUser","secondUser"] | -// | Issue #2 | secondUser | ACME Corp | grafana/grafana | 2 | true | 2020-08-25 16:21:56 +0000 +0000 | 2020-08-25 22:21:56 +0000 +0000 | 2020-08-25 22:21:56 +0000 +0000 | ["enhancement"] | ["firstUser"] | -// | Issue #3 | firstUser | ACME Corp | grafana/grafana | 3 | false | 2020-08-25 16:21:56 +0000 +0000 | null | 2020-08-25 16:21:56 +0000 +0000 | [] | [] | -// +----------------+----------------+----------------------+-----------------+---------------+--------------+---------------------------------+---------------------------------+---------------------------------+-------------------------+----------------------------+ +// +----------------+----------------+----------------------+-----------------+---------------+--------------+-------------------------------+-------------------------------+-------------------------------+-------------------------+----------------------------+ +// | Name: title | Name: author | Name: author_company | Name: repo | Name: number | Name: closed | Name: created_at | Name: closed_at | Name: updated_at | Name: labels | Name: assignees | +// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | +// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []int64 | Type: []bool | Type: []time.Time | Type: []*time.Time | Type: []time.Time | Type: []json.RawMessage | Type: []json.RawMessage | +// +----------------+----------------+----------------------+-----------------+---------------+--------------+-------------------------------+-------------------------------+-------------------------------+-------------------------+----------------------------+ +// | Issue #1 | firstUser | ACME Corp | grafana/grafana | 1 | false | 2020-08-25 16:21:56 +0000 UTC | null | 2020-08-25 16:21:56 +0000 UTC | ["bug","help wanted"] | ["firstUser","secondUser"] | +// | Issue #2 | secondUser | ACME Corp | grafana/grafana | 2 | true | 2020-08-25 16:21:56 +0000 UTC | 2020-08-25 22:21:56 +0000 UTC | 2020-08-25 22:21:56 +0000 UTC | ["enhancement"] | ["firstUser"] | +// | Issue #3 | firstUser | ACME Corp | grafana/grafana | 3 | false | 2020-08-25 16:21:56 +0000 UTC | null | 2020-08-25 16:21:56 +0000 UTC | [] | [] | +// +----------------+----------------+----------------------+-----------------+---------------+--------------+-------------------------------+-------------------------------+-------------------------------+-------------------------+----------------------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/github/testdata/milestones.golden.jsonc b/pkg/github/testdata/milestones.golden.jsonc index 2a4ec5db..a145267c 100644 --- a/pkg/github/testdata/milestones.golden.jsonc +++ b/pkg/github/testdata/milestones.golden.jsonc @@ -3,15 +3,15 @@ // Frame[0] // Name: milestones // Dimensions: 7 Fields by 3 Rows -// +------------------+----------------+--------------+----------------+---------------------------------+---------------------------------+---------------------------------+ -// | Name: title | Name: author | Name: closed | Name: state | Name: created_at | Name: closed_at | Name: due_at | -// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | -// | Type: []string | Type: []string | Type: []bool | Type: []string | Type: []time.Time | Type: []*time.Time | Type: []*time.Time | -// +------------------+----------------+--------------+----------------+---------------------------------+---------------------------------+---------------------------------+ -// | first milestone | testUser | false | OPEN | 2020-08-25 16:21:56 +0000 +0000 | null | 2020-08-29 20:21:56 +0000 +0000 | -// | second milestone | testUser2 | true | CLOSED | 2020-08-25 16:21:56 +0000 +0000 | 2020-08-26 02:21:56 +0000 +0000 | 2020-08-29 20:21:56 +0000 +0000 | -// | third milestone | testUser2 | false | OPEN | 2020-08-25 16:21:56 +0000 +0000 | null | 2020-08-30 16:21:56 +0000 +0000 | -// +------------------+----------------+--------------+----------------+---------------------------------+---------------------------------+---------------------------------+ +// +------------------+----------------+--------------+----------------+-------------------------------+-------------------------------+-------------------------------+ +// | Name: title | Name: author | Name: closed | Name: state | Name: created_at | Name: closed_at | Name: due_at | +// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | +// | Type: []string | Type: []string | Type: []bool | Type: []string | Type: []time.Time | Type: []*time.Time | Type: []*time.Time | +// +------------------+----------------+--------------+----------------+-------------------------------+-------------------------------+-------------------------------+ +// | first milestone | testUser | false | OPEN | 2020-08-25 16:21:56 +0000 UTC | null | 2020-08-29 20:21:56 +0000 UTC | +// | second milestone | testUser2 | true | CLOSED | 2020-08-25 16:21:56 +0000 UTC | 2020-08-26 02:21:56 +0000 UTC | 2020-08-29 20:21:56 +0000 UTC | +// | third milestone | testUser2 | false | OPEN | 2020-08-25 16:21:56 +0000 UTC | null | 2020-08-30 16:21:56 +0000 UTC | +// +------------------+----------------+--------------+----------------+-------------------------------+-------------------------------+-------------------------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/github/testdata/pull_request_reviews.golden.jsonc b/pkg/github/testdata/pull_request_reviews.golden.jsonc index b8264c69..be0d2886 100644 --- a/pkg/github/testdata/pull_request_reviews.golden.jsonc +++ b/pkg/github/testdata/pull_request_reviews.golden.jsonc @@ -3,16 +3,16 @@ // Frame[0] // Name: pull_request_reviews // Dimensions: 18 Fields by 4 Rows -// +---------------------------+--------------------------+--------------------------+------------------------------------------------------+--------------------------------+---------------------------------+---------------------------------+-----------------------------------+---------------------------+--------------------------+---------------------------+---------------------------+-----------------------------+----------------------------------------------------------------------------------+--------------------+----------------------------+---------------------------------+---------------------------------+ -// | Name: pull_request_number | Name: pull_request_title | Name: pull_request_state | Name: pull_request_url | Name: pull_request_author_name | Name: pull_request_author_login | Name: pull_request_author_email | Name: pull_request_author_company | Name: repository | Name: review_author_name | Name: review_author_login | Name: review_author_email | Name: review_author_company | Name: review_url | Name: review_state | Name: review_comment_count | Name: review_updated_at | Name: review_created_at | -// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | -// | Type: []int64 | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []int64 | Type: []time.Time | Type: []time.Time | -// +---------------------------+--------------------------+--------------------------+------------------------------------------------------+--------------------------------+---------------------------------+---------------------------------+-----------------------------------+---------------------------+--------------------------+---------------------------+---------------------------+-----------------------------+----------------------------------------------------------------------------------+--------------------+----------------------------+---------------------------------+---------------------------------+ -// | 1 | PullRequest #1 | OPEN | https://github.com/grafana/github-datasource/pulls/1 | Test User | testUser | user@example.com | ACME corp | grafana/github-datasource | Second User | testUser2 | user2@example.com | ACME corp | https://github.com/grafana/github-datasource/pull/1#pullrequestreview-2461579074 | APPROVED | 10 | 2020-08-25 16:21:56 +0000 +0000 | 2020-08-25 16:21:56 +0000 +0000 | -// | 1 | PullRequest #1 | OPEN | https://github.com/grafana/github-datasource/pulls/1 | Test User | testUser | user@example.com | ACME corp | grafana/github-datasource | Third User | testUser3 | user3@example.com | ACME corp | https://github.com/grafana/github-datasource/pull/1#pullrequestreview-2461579074 | APPROVED | 1 | 2020-08-25 16:21:56 +0000 +0000 | 2020-08-25 16:21:56 +0000 +0000 | -// | 2 | PullRequest #2 | OPEN | https://github.com/grafana/github-datasource/pulls/2 | Second User | testUser2 | user2@example.com | ACME corp | grafana/github-datasource | Test User | testUser | user@example.com | ACME corp | https://github.com/grafana/github-datasource/pull/1#pullrequestreview-2461579074 | APPROVED | 19 | 2020-08-25 16:21:56 +0000 +0000 | 2020-08-25 16:21:56 +0000 +0000 | -// | 3 | PullRequest #2 | OPEN | https://github.com/grafana/github-datasource/pulls/3 | Second User | testUser2 | user2@example.com | ACME corp | grafana/github-datasource | Test User | testUser | user@example.com | ACME corp | https://github.com/grafana/github-datasource/pull/1#pullrequestreview-2461579074 | APPROVED | 1 | 2020-08-25 16:21:56 +0000 +0000 | 2020-08-25 16:21:56 +0000 +0000 | -// +---------------------------+--------------------------+--------------------------+------------------------------------------------------+--------------------------------+---------------------------------+---------------------------------+-----------------------------------+---------------------------+--------------------------+---------------------------+---------------------------+-----------------------------+----------------------------------------------------------------------------------+--------------------+----------------------------+---------------------------------+---------------------------------+ +// +---------------------------+--------------------------+--------------------------+------------------------------------------------------+--------------------------------+---------------------------------+---------------------------------+-----------------------------------+---------------------------+--------------------------+---------------------------+---------------------------+-----------------------------+----------------------------------------------------------------------------------+--------------------+----------------------------+-------------------------------+-------------------------------+ +// | Name: pull_request_number | Name: pull_request_title | Name: pull_request_state | Name: pull_request_url | Name: pull_request_author_name | Name: pull_request_author_login | Name: pull_request_author_email | Name: pull_request_author_company | Name: repository | Name: review_author_name | Name: review_author_login | Name: review_author_email | Name: review_author_company | Name: review_url | Name: review_state | Name: review_comment_count | Name: review_updated_at | Name: review_created_at | +// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | +// | Type: []int64 | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []int64 | Type: []time.Time | Type: []time.Time | +// +---------------------------+--------------------------+--------------------------+------------------------------------------------------+--------------------------------+---------------------------------+---------------------------------+-----------------------------------+---------------------------+--------------------------+---------------------------+---------------------------+-----------------------------+----------------------------------------------------------------------------------+--------------------+----------------------------+-------------------------------+-------------------------------+ +// | 1 | PullRequest #1 | OPEN | https://github.com/grafana/github-datasource/pulls/1 | Test User | testUser | user@example.com | ACME corp | grafana/github-datasource | Second User | testUser2 | user2@example.com | ACME corp | https://github.com/grafana/github-datasource/pull/1#pullrequestreview-2461579074 | APPROVED | 10 | 2020-08-25 16:21:56 +0000 UTC | 2020-08-25 16:21:56 +0000 UTC | +// | 1 | PullRequest #1 | OPEN | https://github.com/grafana/github-datasource/pulls/1 | Test User | testUser | user@example.com | ACME corp | grafana/github-datasource | Third User | testUser3 | user3@example.com | ACME corp | https://github.com/grafana/github-datasource/pull/1#pullrequestreview-2461579074 | APPROVED | 1 | 2020-08-25 16:21:56 +0000 UTC | 2020-08-25 16:21:56 +0000 UTC | +// | 2 | PullRequest #2 | OPEN | https://github.com/grafana/github-datasource/pulls/2 | Second User | testUser2 | user2@example.com | ACME corp | grafana/github-datasource | Test User | testUser | user@example.com | ACME corp | https://github.com/grafana/github-datasource/pull/1#pullrequestreview-2461579074 | APPROVED | 19 | 2020-08-25 16:21:56 +0000 UTC | 2020-08-25 16:21:56 +0000 UTC | +// | 3 | PullRequest #2 | OPEN | https://github.com/grafana/github-datasource/pulls/3 | Second User | testUser2 | user2@example.com | ACME corp | grafana/github-datasource | Test User | testUser | user@example.com | ACME corp | https://github.com/grafana/github-datasource/pull/1#pullrequestreview-2461579074 | APPROVED | 1 | 2020-08-25 16:21:56 +0000 UTC | 2020-08-25 16:21:56 +0000 UTC | +// +---------------------------+--------------------------+--------------------------+------------------------------------------------------+--------------------------------+---------------------------------+---------------------------------+-----------------------------------+---------------------------+--------------------------+---------------------------+---------------------------+-----------------------------+----------------------------------------------------------------------------------+--------------------+----------------------------+-------------------------------+-------------------------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/github/testdata/pull_requests.golden.jsonc b/pkg/github/testdata/pull_requests.golden.jsonc index 3e695b68..f9d96967 100644 --- a/pkg/github/testdata/pull_requests.golden.jsonc +++ b/pkg/github/testdata/pull_requests.golden.jsonc @@ -2,16 +2,16 @@ // // Frame[0] // Name: pull_requests -// Dimensions: 25 Fields by 3 Rows -// +---------------+----------------+------------------------------------------------------+-----------------+-----------------+---------------------------+----------------+-------------------+--------------------+--------------------+----------------------+--------------+----------------+--------------+--------------+-----------------+---------------------------------+---------------------------------+----------------------+-----------------------+-----------------------+-------------------------+---------------------------------+---------------------------------+-----------------+ -// | Name: number | Name: title | Name: url | Name: additions | Name: deletions | Name: repository | Name: state | Name: author_name | Name: author_login | Name: author_email | Name: author_company | Name: closed | Name: is_draft | Name: locked | Name: merged | Name: mergeable | Name: closed_at | Name: merged_at | Name: merged_by_name | Name: merged_by_login | Name: merged_by_email | Name: merged_by_company | Name: updated_at | Name: created_at | Name: open_time | -// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | -// | Type: []int64 | Type: []string | Type: []string | Type: []int64 | Type: []int64 | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []bool | Type: []bool | Type: []bool | Type: []bool | Type: []string | Type: []*time.Time | Type: []*time.Time | Type: []*string | Type: []*string | Type: []*string | Type: []*string | Type: []time.Time | Type: []time.Time | Type: []float64 | -// +---------------+----------------+------------------------------------------------------+-----------------+-----------------+---------------------------+----------------+-------------------+--------------------+--------------------+----------------------+--------------+----------------+--------------+--------------+-----------------+---------------------------------+---------------------------------+----------------------+-----------------------+-----------------------+-------------------------+---------------------------------+---------------------------------+-----------------+ -// | 1 | PullRequest #1 | https://github.com/grafana/github-datasource/pulls/1 | 5 | 1 | grafana/github-datasource | OPEN | Test User | testUser | user@example.com | ACME corp | true | false | false | true | MERGEABLE | 2020-08-25 18:01:56 +0000 +0000 | 2020-08-25 18:01:56 +0000 +0000 | null | null | null | null | 2020-08-25 16:21:56 +0000 +0000 | 2020-08-25 16:21:56 +0000 +0000 | 6000 | -// | 2 | PullRequest #2 | https://github.com/grafana/github-datasource/pulls/2 | 0 | 0 | grafana/github-datasource | OPEN | Second User | testUser2 | user2@example.com | ACME corp | true | false | false | true | MERGEABLE | 2020-08-25 18:01:56 +0000 +0000 | 2020-08-25 18:01:56 +0000 +0000 | Test User | testUser | user@example.com | ACME corp | 2020-08-25 18:21:56 +0000 +0000 | 2020-08-25 16:21:56 +0000 +0000 | 6000 | -// | 3 | PullRequest #2 | https://github.com/grafana/github-datasource/pulls/3 | 0 | 0 | grafana/github-datasource | OPEN | Second User | testUser2 | user2@example.com | ACME corp | false | false | false | false | MERGEABLE | null | 2020-08-25 18:01:56 +0000 +0000 | null | null | null | null | 2020-08-25 18:21:56 +0000 +0000 | 2020-08-25 16:21:56 +0000 +0000 | 6000 | -// +---------------+----------------+------------------------------------------------------+-----------------+-----------------+---------------------------+----------------+-------------------+--------------------+--------------------+----------------------+--------------+----------------+--------------+--------------+-----------------+---------------------------------+---------------------------------+----------------------+-----------------------+-----------------------+-------------------------+---------------------------------+---------------------------------+-----------------+ +// Dimensions: 26 Fields by 3 Rows +// +---------------+----------------+------------------------------------------------------+-----------------+-----------------+---------------------------+----------------+-------------------+--------------------+--------------------+----------------------+--------------+----------------+--------------+--------------+-----------------+-------------------------------+-------------------------------+----------------------+-----------------------+-----------------------+-------------------------+-------------------------------+-------------------------------+-----------------+-------------------------+ +// | Name: number | Name: title | Name: url | Name: additions | Name: deletions | Name: repository | Name: state | Name: author_name | Name: author_login | Name: author_email | Name: author_company | Name: closed | Name: is_draft | Name: locked | Name: merged | Name: mergeable | Name: closed_at | Name: merged_at | Name: merged_by_name | Name: merged_by_login | Name: merged_by_email | Name: merged_by_company | Name: updated_at | Name: created_at | Name: open_time | Name: labels | +// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | +// | Type: []int64 | Type: []string | Type: []string | Type: []int64 | Type: []int64 | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []bool | Type: []bool | Type: []bool | Type: []bool | Type: []string | Type: []*time.Time | Type: []*time.Time | Type: []*string | Type: []*string | Type: []*string | Type: []*string | Type: []time.Time | Type: []time.Time | Type: []float64 | Type: []json.RawMessage | +// +---------------+----------------+------------------------------------------------------+-----------------+-----------------+---------------------------+----------------+-------------------+--------------------+--------------------+----------------------+--------------+----------------+--------------+--------------+-----------------+-------------------------------+-------------------------------+----------------------+-----------------------+-----------------------+-------------------------+-------------------------------+-------------------------------+-----------------+-------------------------+ +// | 1 | PullRequest #1 | https://github.com/grafana/github-datasource/pulls/1 | 5 | 1 | grafana/github-datasource | OPEN | Test User | testUser | user@example.com | ACME corp | true | false | false | true | MERGEABLE | 2020-08-25 18:01:56 +0000 UTC | 2020-08-25 18:01:56 +0000 UTC | null | null | null | null | 2020-08-25 16:21:56 +0000 UTC | 2020-08-25 16:21:56 +0000 UTC | 6000 | ["bug","enhancement"] | +// | 2 | PullRequest #2 | https://github.com/grafana/github-datasource/pulls/2 | 0 | 0 | grafana/github-datasource | OPEN | Second User | testUser2 | user2@example.com | ACME corp | true | false | false | true | MERGEABLE | 2020-08-25 18:01:56 +0000 UTC | 2020-08-25 18:01:56 +0000 UTC | Test User | testUser | user@example.com | ACME corp | 2020-08-25 18:21:56 +0000 UTC | 2020-08-25 16:21:56 +0000 UTC | 6000 | ["documentation"] | +// | 3 | PullRequest #2 | https://github.com/grafana/github-datasource/pulls/3 | 0 | 0 | grafana/github-datasource | OPEN | Second User | testUser2 | user2@example.com | ACME corp | false | false | false | false | MERGEABLE | null | 2020-08-25 18:01:56 +0000 UTC | null | null | null | null | 2020-08-25 18:21:56 +0000 UTC | 2020-08-25 16:21:56 +0000 UTC | 6000 | [] | +// +---------------+----------------+------------------------------------------------------+-----------------+-----------------+---------------------------+----------------+-------------------+--------------------+--------------------+----------------------+--------------+----------------+--------------+--------------+-----------------+-------------------------------+-------------------------------+----------------------+-----------------------+-----------------------+-------------------------+-------------------------------+-------------------------------+-----------------+-------------------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 @@ -205,6 +205,13 @@ "config": { "unit": "s" } + }, + { + "name": "labels", + "type": "other", + "typeInfo": { + "frame": "json.RawMessage" + } } ] }, @@ -334,6 +341,16 @@ 6000, 6000, 6000 + ], + [ + [ + "bug", + "enhancement" + ], + [ + "documentation" + ], + [] ] ] } diff --git a/pkg/github/testdata/releases.golden.jsonc b/pkg/github/testdata/releases.golden.jsonc index 315cfdc9..ab36f5e7 100644 --- a/pkg/github/testdata/releases.golden.jsonc +++ b/pkg/github/testdata/releases.golden.jsonc @@ -3,14 +3,14 @@ // Frame[0] // Name: releases // Dimensions: 8 Fields by 2 Rows -// +----------------+------------------+----------------+---------------------+----------------+----------------------------+---------------------------------+---------------------------------+ -// | Name: name | Name: created_by | Name: is_draft | Name: is_prerelease | Name: tag | Name: url | Name: created_at | Name: published_at | -// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | -// | Type: []string | Type: []string | Type: []bool | Type: []bool | Type: []string | Type: []string | Type: []time.Time | Type: []*time.Time | -// +----------------+------------------+----------------+---------------------+----------------+----------------------------+---------------------------------+---------------------------------+ -// | Release #1 | exampleUser | true | false | v1.0.0 | https://example.com/v1.0.0 | 2020-08-25 16:21:56 +0000 +0000 | null | -// | Release #2 | exampleUser | true | false | v1.1.0 | https://example.com/v1.1.0 | 2020-08-25 16:21:56 +0000 +0000 | 2020-08-25 17:21:56 +0000 +0000 | -// +----------------+------------------+----------------+---------------------+----------------+----------------------------+---------------------------------+---------------------------------+ +// +----------------+------------------+----------------+---------------------+----------------+----------------------------+-------------------------------+-------------------------------+ +// | Name: name | Name: created_by | Name: is_draft | Name: is_prerelease | Name: tag | Name: url | Name: created_at | Name: published_at | +// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | +// | Type: []string | Type: []string | Type: []bool | Type: []bool | Type: []string | Type: []string | Type: []time.Time | Type: []*time.Time | +// +----------------+------------------+----------------+---------------------+----------------+----------------------------+-------------------------------+-------------------------------+ +// | Release #1 | exampleUser | true | false | v1.0.0 | https://example.com/v1.0.0 | 2020-08-25 16:21:56 +0000 UTC | null | +// | Release #2 | exampleUser | true | false | v1.1.0 | https://example.com/v1.1.0 | 2020-08-25 16:21:56 +0000 UTC | 2020-08-25 17:21:56 +0000 UTC | +// +----------------+------------------+----------------+---------------------+----------------+----------------------------+-------------------------------+-------------------------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/github/testdata/repositories.golden.jsonc b/pkg/github/testdata/repositories.golden.jsonc index 061d7d87..2742c235 100644 --- a/pkg/github/testdata/repositories.golden.jsonc +++ b/pkg/github/testdata/repositories.golden.jsonc @@ -3,14 +3,14 @@ // Frame[0] // Name: repositories // Dimensions: 9 Fields by 2 Rows -// +----------------+----------------+-----------------------+----------------------------+---------------+---------------+-----------------+------------------+---------------------------------+ -// | Name: name | Name: owner | Name: name_with_owner | Name: url | Name: forks | Name: is_fork | Name: is_mirror | Name: is_private | Name: created_at | -// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | -// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []int64 | Type: []bool | Type: []bool | Type: []bool | Type: []time.Time | -// +----------------+----------------+-----------------------+----------------------------+---------------+---------------+-----------------+------------------+---------------------------------+ -// | grafana | grafana | grafana/grafana | github.com/grafana/grafana | 10 | true | true | false | 2020-08-25 16:21:56 +0000 +0000 | -// | loki | grafana | grafana/loki | github.com/grafana/loki | 12 | true | true | false | 2020-08-25 16:21:56 +0000 +0000 | -// +----------------+----------------+-----------------------+----------------------------+---------------+---------------+-----------------+------------------+---------------------------------+ +// +----------------+----------------+-----------------------+----------------------------+---------------+---------------+-----------------+------------------+-------------------------------+ +// | Name: name | Name: owner | Name: name_with_owner | Name: url | Name: forks | Name: is_fork | Name: is_mirror | Name: is_private | Name: created_at | +// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | +// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []int64 | Type: []bool | Type: []bool | Type: []bool | Type: []time.Time | +// +----------------+----------------+-----------------------+----------------------------+---------------+---------------+-----------------+------------------+-------------------------------+ +// | grafana | grafana | grafana/grafana | github.com/grafana/grafana | 10 | true | true | false | 2020-08-25 16:21:56 +0000 UTC | +// | loki | grafana | grafana/loki | github.com/grafana/loki | 12 | true | true | false | 2020-08-25 16:21:56 +0000 UTC | +// +----------------+----------------+-----------------------+----------------------------+---------------+---------------+-----------------+------------------+-------------------------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/github/testdata/stargazers.golden.jsonc b/pkg/github/testdata/stargazers.golden.jsonc index 40f8a583..c681abe3 100644 --- a/pkg/github/testdata/stargazers.golden.jsonc +++ b/pkg/github/testdata/stargazers.golden.jsonc @@ -9,15 +9,15 @@ // } // Name: stargazers // Dimensions: 8 Fields by 3 Rows -// +---------------------------------+------------------+----------------+----------------+----------------+----------------+----------------------------+---------------------------------------------+ -// | Name: starred_at | Name: star_count | Name: id | Name: login | Name: git_name | Name: company | Name: email | Name: url | -// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | -// | Type: []time.Time | Type: []int64 | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | -// +---------------------------------+------------------+----------------+----------------+----------------+----------------+----------------------------+---------------------------------------------+ -// | 2023-01-14 10:21:41 +0000 +0000 | 3 | NEVER | gonna | Run | Around | and_desert_you@example.org | https://www.youtube.com/watch?v=dQw4w9WgXcQ | -// | 2023-01-14 10:23:41 +0000 +0000 | 2 | NEVER | gonna | Let | You | down@example.org | | -// | 2023-01-14 10:25:41 +0000 +0000 | 1 | NEVER | gonna | Give | You | up@example.org | | -// +---------------------------------+------------------+----------------+----------------+----------------+----------------+----------------------------+---------------------------------------------+ +// +-------------------------------+------------------+----------------+----------------+----------------+----------------+----------------------------+---------------------------------------------+ +// | Name: starred_at | Name: star_count | Name: id | Name: login | Name: git_name | Name: company | Name: email | Name: url | +// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | +// | Type: []time.Time | Type: []int64 | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | +// +-------------------------------+------------------+----------------+----------------+----------------+----------------+----------------------------+---------------------------------------------+ +// | 2023-01-14 10:21:41 +0000 UTC | 3 | NEVER | gonna | Run | Around | and_desert_you@example.org | https://www.youtube.com/watch?v=dQw4w9WgXcQ | +// | 2023-01-14 10:23:41 +0000 UTC | 2 | NEVER | gonna | Let | You | down@example.org | | +// | 2023-01-14 10:25:41 +0000 UTC | 1 | NEVER | gonna | Give | You | up@example.org | | +// +-------------------------------+------------------+----------------+----------------+----------------+----------------+----------------------------+---------------------------------------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/github/testdata/tags.golden.jsonc b/pkg/github/testdata/tags.golden.jsonc index e3e3ac7f..7071a1e0 100644 --- a/pkg/github/testdata/tags.golden.jsonc +++ b/pkg/github/testdata/tags.golden.jsonc @@ -3,14 +3,14 @@ // Frame[0] // Name: tags // Dimensions: 7 Fields by 2 Rows -// +----------------+----------------+-----------------+--------------------+--------------------+----------------------+---------------------------------+ -// | Name: name | Name: id | Name: author | Name: author_login | Name: author_email | Name: author_company | Name: date | -// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | -// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []time.Time | -// +----------------+----------------+-----------------+--------------------+--------------------+----------------------+---------------------------------+ -// | v1.0.0 | | First Committer | firstCommitter | first@example.com | ACME Corp | 2020-08-25 16:21:56 +0000 +0000 | -// | v1.1.0 | | First Committer | firstCommitter | first@example.com | ACME Corp | 2020-08-25 16:21:56 +0000 +0000 | -// +----------------+----------------+-----------------+--------------------+--------------------+----------------------+---------------------------------+ +// +----------------+----------------+-----------------+--------------------+--------------------+----------------------+-------------------------------+ +// | Name: name | Name: id | Name: author | Name: author_login | Name: author_email | Name: author_company | Name: date | +// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | +// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []string | Type: []time.Time | +// +----------------+----------------+-----------------+--------------------+--------------------+----------------------+-------------------------------+ +// | v1.0.0 | | First Committer | firstCommitter | first@example.com | ACME Corp | 2020-08-25 16:21:56 +0000 UTC | +// | v1.1.0 | | First Committer | firstCommitter | first@example.com | ACME Corp | 2020-08-25 16:21:56 +0000 UTC | +// +----------------+----------------+-----------------+--------------------+--------------------+----------------------+-------------------------------+ // // // 🌟 This was machine generated. Do not edit. 🌟