From 2e8ae052c234fc15f025eda84bc2f3b42d9c1ba1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Mar 2026 11:13:13 +0000 Subject: [PATCH 1/8] Initial plan From cd22646927bcdfc4e11e85e85e996841cf1ee3b8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Mar 2026 11:20:08 +0000 Subject: [PATCH 2/8] Add config JSON schema generation from Zod and expose via resource call - Export Zod schemas from src/types/config.ts - Create scripts/generate-config-schema.ts to generate JSON schema - Add generate:config-schema npm script - Generate config-schema.json for frontend and backend - Create pkg/configschema package with embedded JSON schema - Add /config-schema resource call endpoint in CallResource Co-authored-by: yesoreyeram <153843+yesoreyeram@users.noreply.github.com> --- package.json | 3 +- pkg/configschema/config_schema.json | 153 ++++++++++++++++++++++++++++ pkg/configschema/configschema.go | 8 ++ pkg/plugin/instance.go | 9 ++ scripts/generate-config-schema.ts | 30 ++++++ src/schemas/config-schema.json | 153 ++++++++++++++++++++++++++++ src/types/config.ts | 4 +- 7 files changed, 357 insertions(+), 3 deletions(-) create mode 100644 pkg/configschema/config_schema.json create mode 100644 pkg/configschema/configschema.go create mode 100644 scripts/generate-config-schema.ts create mode 100644 src/schemas/config-schema.json diff --git a/package.json b/package.json index ee72ed26..99e693fe 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,8 @@ "spellcheck": "cspell -c cspell.config.json \"**/*.{ts,tsx,js,go,md,mdx,yml,yaml,json,scss,css}\"", "test": "jest --watch --onlyChanged", "test:ci": "jest --passWithNoTests --maxWorkers 4", - "typecheck": "tsc --noEmit" + "typecheck": "tsc --noEmit", + "generate:config-schema": "ts-node scripts/generate-config-schema.ts" }, "dependencies": { "@emotion/css": "11.13.5", diff --git a/pkg/configschema/config_schema.json b/pkg/configschema/config_schema.json new file mode 100644 index 00000000..78e2dc40 --- /dev/null +++ b/pkg/configschema/config_schema.json @@ -0,0 +1,153 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "GitHubDataSourceConfig", + "description": "Configuration schema for the Grafana GitHub data source plugin", + "type": "object", + "properties": { + "jsonData": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "allOf": [ + { + "anyOf": [ + { + "anyOf": [ + { + "type": "object", + "properties": { + "githubPlan": { + "type": "string", + "const": "github-basic" + }, + "githubUrl": { + "not": {} + } + }, + "required": [ + "githubUrl" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "githubPlan": { + "type": "string", + "const": "github-enterprise-cloud" + }, + "githubUrl": { + "not": {} + } + }, + "required": [ + "githubPlan", + "githubUrl" + ], + "additionalProperties": false + } + ] + }, + { + "type": "object", + "properties": { + "githubPlan": { + "type": "string", + "const": "github-enterprise-server" + }, + "githubUrl": { + "type": "string" + } + }, + "required": [ + "githubPlan", + "githubUrl" + ], + "additionalProperties": false + } + ] + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "selectedAuthType": { + "type": "string", + "const": "personal-access-token" + }, + "appId": { + "not": {} + }, + "installationId": { + "not": {} + } + }, + "required": [ + "appId", + "installationId" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "selectedAuthType": { + "type": "string", + "const": "github-app" + }, + "appId": { + "type": "string" + }, + "installationId": { + "type": "string" + } + }, + "required": [ + "selectedAuthType", + "appId", + "installationId" + ], + "additionalProperties": false + } + ] + } + ] + }, + "secureJsonData": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "type": "object", + "properties": { + "accessToken": { + "type": "string" + }, + "privateKey": { + "not": {} + } + }, + "required": [ + "accessToken", + "privateKey" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "accessToken": { + "not": {} + }, + "privateKey": { + "type": "string" + } + }, + "required": [ + "accessToken", + "privateKey" + ], + "additionalProperties": false + } + ] + } + } +} diff --git a/pkg/configschema/configschema.go b/pkg/configschema/configschema.go new file mode 100644 index 00000000..470fcea9 --- /dev/null +++ b/pkg/configschema/configschema.go @@ -0,0 +1,8 @@ +package configschema + +import ( + _ "embed" +) + +//go:embed config_schema.json +var ConfigSchemaJSON []byte diff --git a/pkg/plugin/instance.go b/pkg/plugin/instance.go index cdfe6c45..2450156f 100644 --- a/pkg/plugin/instance.go +++ b/pkg/plugin/instance.go @@ -3,11 +3,13 @@ package plugin import ( "context" "fmt" + "net/http" "github.com/grafana/grafana-plugin-sdk-go/backend" "github.com/grafana/grafana-plugin-sdk-go/backend/instancemgmt" schemas "github.com/grafana/schemads" + "github.com/grafana/github-datasource/pkg/configschema" "github.com/grafana/github-datasource/pkg/github" "github.com/grafana/github-datasource/pkg/models" ) @@ -19,6 +21,13 @@ type GitHubInstanceWithSchema struct { } func (g *GitHubInstanceWithSchema) CallResource(ctx context.Context, req *backend.CallResourceRequest, sender backend.CallResourceResponseSender) error { + if req.Path == "config-schema" { + return sender.Send(&backend.CallResourceResponse{ + Status: http.StatusOK, + Headers: map[string][]string{"Content-Type": {"application/json"}}, + Body: configschema.ConfigSchemaJSON, + }) + } return g.SchemaDatasource.CallResource(ctx, req, sender) } diff --git a/scripts/generate-config-schema.ts b/scripts/generate-config-schema.ts new file mode 100644 index 00000000..f8bfb22d --- /dev/null +++ b/scripts/generate-config-schema.ts @@ -0,0 +1,30 @@ +import { z } from 'zod'; +import * as fs from 'fs'; +import * as path from 'path'; + +import { GitHubDataSourceOptionsSchema, GitHubSecureJsonDataSchema } from '../src/types/config'; + +const configSchema = { + $schema: 'https://json-schema.org/draft/2020-12/schema', + title: 'GitHubDataSourceConfig', + description: 'Configuration schema for the Grafana GitHub data source plugin', + type: 'object' as const, + properties: { + jsonData: z.toJSONSchema(GitHubDataSourceOptionsSchema), + secureJsonData: z.toJSONSchema(GitHubSecureJsonDataSchema), + }, +}; + +const schemaJSON = JSON.stringify(configSchema, null, 2) + '\n'; + +// Write to src/schemas/ for frontend consumers +const frontendPath = path.resolve(__dirname, '..', 'src', 'schemas', 'config-schema.json'); +fs.mkdirSync(path.dirname(frontendPath), { recursive: true }); +fs.writeFileSync(frontendPath, schemaJSON); +console.log(`Config JSON schema written to ${frontendPath}`); + +// Write to pkg/configschema/ for Go backend embedding +const backendPath = path.resolve(__dirname, '..', 'pkg', 'configschema', 'config_schema.json'); +fs.mkdirSync(path.dirname(backendPath), { recursive: true }); +fs.writeFileSync(backendPath, schemaJSON); +console.log(`Config JSON schema written to ${backendPath}`); diff --git a/src/schemas/config-schema.json b/src/schemas/config-schema.json new file mode 100644 index 00000000..78e2dc40 --- /dev/null +++ b/src/schemas/config-schema.json @@ -0,0 +1,153 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "title": "GitHubDataSourceConfig", + "description": "Configuration schema for the Grafana GitHub data source plugin", + "type": "object", + "properties": { + "jsonData": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "allOf": [ + { + "anyOf": [ + { + "anyOf": [ + { + "type": "object", + "properties": { + "githubPlan": { + "type": "string", + "const": "github-basic" + }, + "githubUrl": { + "not": {} + } + }, + "required": [ + "githubUrl" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "githubPlan": { + "type": "string", + "const": "github-enterprise-cloud" + }, + "githubUrl": { + "not": {} + } + }, + "required": [ + "githubPlan", + "githubUrl" + ], + "additionalProperties": false + } + ] + }, + { + "type": "object", + "properties": { + "githubPlan": { + "type": "string", + "const": "github-enterprise-server" + }, + "githubUrl": { + "type": "string" + } + }, + "required": [ + "githubPlan", + "githubUrl" + ], + "additionalProperties": false + } + ] + }, + { + "anyOf": [ + { + "type": "object", + "properties": { + "selectedAuthType": { + "type": "string", + "const": "personal-access-token" + }, + "appId": { + "not": {} + }, + "installationId": { + "not": {} + } + }, + "required": [ + "appId", + "installationId" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "selectedAuthType": { + "type": "string", + "const": "github-app" + }, + "appId": { + "type": "string" + }, + "installationId": { + "type": "string" + } + }, + "required": [ + "selectedAuthType", + "appId", + "installationId" + ], + "additionalProperties": false + } + ] + } + ] + }, + "secureJsonData": { + "$schema": "https://json-schema.org/draft/2020-12/schema", + "anyOf": [ + { + "type": "object", + "properties": { + "accessToken": { + "type": "string" + }, + "privateKey": { + "not": {} + } + }, + "required": [ + "accessToken", + "privateKey" + ], + "additionalProperties": false + }, + { + "type": "object", + "properties": { + "accessToken": { + "not": {} + }, + "privateKey": { + "type": "string" + } + }, + "required": [ + "accessToken", + "privateKey" + ], + "additionalProperties": false + } + ] + } + } +} diff --git a/src/types/config.ts b/src/types/config.ts index 6505eb71..058ee4fb 100644 --- a/src/types/config.ts +++ b/src/types/config.ts @@ -55,7 +55,7 @@ const GithubDataSourceAuthOptionsSchema = GitHubDataSourcePATAuthOptionsSchema //#endregion -const GitHubDataSourceOptionsSchema = z.intersection(GithubDataSourceCommonOptionsSchema, GithubDataSourceAuthOptionsSchema); +export const GitHubDataSourceOptionsSchema = z.intersection(GithubDataSourceCommonOptionsSchema, GithubDataSourceAuthOptionsSchema); export type GitHubDataSourceOptions = z.infer & DataSourceJsonData; @@ -77,7 +77,7 @@ const GitHubSecureJsonDataAuthGHAppSchema = z.object({ //#endregion -const GitHubSecureJsonDataSchema = GitHubSecureJsonDataAuthPATSchema +export const GitHubSecureJsonDataSchema = GitHubSecureJsonDataAuthPATSchema .or(GitHubSecureJsonDataAuthGHAppSchema) export type GitHubSecureJsonData = z.infer; From d73e42158ac7c7069b33286f61034c5654a7e88d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Mar 2026 11:20:56 +0000 Subject: [PATCH 3/8] Add GitHub Actions workflow and pre-commit hook for config schema validation - Add .github/workflows/check-config-schema.yml to verify schema freshness - Add scripts/pre-commit hook to auto-update schema on config type changes Co-authored-by: yesoreyeram <153843+yesoreyeram@users.noreply.github.com> --- .github/workflows/check-config-schema.yml | 39 +++++++++++++++++++ pkg/github/testdata/commits.golden.jsonc | 16 ++++---- pkg/github/testdata/issues.golden.jsonc | 18 ++++----- pkg/github/testdata/milestones.golden.jsonc | 18 ++++----- .../pull_request_reviews.golden.jsonc | 20 +++++----- .../testdata/pull_requests.golden.jsonc | 18 ++++----- pkg/github/testdata/releases.golden.jsonc | 16 ++++---- pkg/github/testdata/repositories.golden.jsonc | 16 ++++---- pkg/github/testdata/stargazers.golden.jsonc | 6 +-- pkg/github/testdata/tags.golden.jsonc | 16 ++++---- scripts/pre-commit | 18 +++++++++ 11 files changed, 129 insertions(+), 72 deletions(-) create mode 100644 .github/workflows/check-config-schema.yml create mode 100755 scripts/pre-commit diff --git a/.github/workflows/check-config-schema.yml b/.github/workflows/check-config-schema.yml new file mode 100644 index 00000000..dea76352 --- /dev/null +++ b/.github/workflows/check-config-schema.yml @@ -0,0 +1,39 @@ +name: Check Config Schema + +on: + pull_request: + paths: + - 'src/types/config.ts' + - 'scripts/generate-config-schema.ts' + push: + branches: + - main + paths: + - 'src/types/config.ts' + - 'scripts/generate-config-schema.ts' + +jobs: + check-config-schema: + name: Verify config schema is up-to-date + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + + - name: Install dependencies + run: yarn install --immutable + + - name: Generate config schema + run: yarn generate:config-schema + + - name: Check for uncommitted schema changes + run: | + if ! git diff --exit-code src/schemas/config-schema.json pkg/configschema/config_schema.json; then + echo "::error::Config schema is out of date. Run 'yarn generate:config-schema' and commit the changes." + exit 1 + fi + echo "Config schema is up-to-date." 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 89c98fbd..1ff75660 100644 --- a/pkg/github/testdata/issues.golden.jsonc +++ b/pkg/github/testdata/issues.golden.jsonc @@ -3,15 +3,15 @@ // Frame[0] // Name: issues // Dimensions: 13 Fields by 3 Rows -// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+---------------------------------+---------------------------------+---------------------------------+-------------------------+----------------------------+-----------------+ -// | Name: title | Name: author | Name: author_company | Name: repo | Name: number | Name: state | Name: closed | Name: created_at | Name: closed_at | Name: updated_at | Name: labels | Name: assignees | Name: milestone | -// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | -// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []int64 | Type: []string | Type: []bool | Type: []time.Time | Type: []*time.Time | Type: []time.Time | Type: []json.RawMessage | Type: []json.RawMessage | Type: []*string | -// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+---------------------------------+---------------------------------+---------------------------------+-------------------------+----------------------------+-----------------+ -// | Issue #1 | firstUser | ACME Corp | grafana/grafana | 1 | open | false | 2020-08-25 16:21:56 +0000 +0000 | null | 2020-08-25 16:21:56 +0000 +0000 | ["bug","help wanted"] | ["firstUser","secondUser"] | v1.0 | -// | Issue #2 | secondUser | ACME Corp | grafana/grafana | 2 | closed | 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"] | v1.0 | -// | Issue #3 | firstUser | ACME Corp | grafana/grafana | 3 | open | false | 2020-08-25 16:21:56 +0000 +0000 | null | 2020-08-25 16:21:56 +0000 +0000 | [] | [] | null | -// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+---------------------------------+---------------------------------+---------------------------------+-------------------------+----------------------------+-----------------+ +// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+-------------------------------+-------------------------------+-------------------------------+-------------------------+----------------------------+-----------------+ +// | Name: title | Name: author | Name: author_company | Name: repo | Name: number | Name: state | Name: closed | Name: created_at | Name: closed_at | Name: updated_at | Name: labels | Name: assignees | Name: milestone | +// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | +// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []int64 | Type: []string | Type: []bool | Type: []time.Time | Type: []*time.Time | Type: []time.Time | Type: []json.RawMessage | Type: []json.RawMessage | Type: []*string | +// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+-------------------------------+-------------------------------+-------------------------------+-------------------------+----------------------------+-----------------+ +// | Issue #1 | firstUser | ACME Corp | grafana/grafana | 1 | open | false | 2020-08-25 16:21:56 +0000 UTC | null | 2020-08-25 16:21:56 +0000 UTC | ["bug","help wanted"] | ["firstUser","secondUser"] | v1.0 | +// | Issue #2 | secondUser | ACME Corp | grafana/grafana | 2 | closed | 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"] | v1.0 | +// | Issue #3 | firstUser | ACME Corp | grafana/grafana | 3 | open | false | 2020-08-25 16:21:56 +0000 UTC | null | 2020-08-25 16:21:56 +0000 UTC | [] | [] | null | +// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+-------------------------------+-------------------------------+-------------------------------+-------------------------+----------------------------+-----------------+ // // // 🌟 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 3dc085d9..f9d96967 100644 --- a/pkg/github/testdata/pull_requests.golden.jsonc +++ b/pkg/github/testdata/pull_requests.golden.jsonc @@ -3,15 +3,15 @@ // Frame[0] // Name: pull_requests // 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 +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 | ["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 +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 | ["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 +0000 | null | null | null | null | 2020-08-25 18:21:56 +0000 +0000 | 2020-08-25 16:21:56 +0000 +0000 | 6000 | [] | -// +---------------+----------------+------------------------------------------------------+-----------------+-----------------+---------------------------+----------------+-------------------+--------------------+--------------------+----------------------+--------------+----------------+--------------+--------------+-----------------+---------------------------------+---------------------------------+----------------------+-----------------------+-----------------------+-------------------------+---------------------------------+---------------------------------+-----------------+-------------------------+ +// +---------------+----------------+------------------------------------------------------+-----------------+-----------------+---------------------------+----------------+-------------------+--------------------+--------------------+----------------------+--------------+----------------+--------------+--------------+-----------------+-------------------------------+-------------------------------+----------------------+-----------------------+-----------------------+-------------------------+-------------------------------+-------------------------------+-----------------+-------------------------+ +// | 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. 🌟 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 c20601d1..c681abe3 100644 --- a/pkg/github/testdata/stargazers.golden.jsonc +++ b/pkg/github/testdata/stargazers.golden.jsonc @@ -14,9 +14,9 @@ // | 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 GMT | 3 | NEVER | gonna | Run | Around | and_desert_you@example.org | https://www.youtube.com/watch?v=dQw4w9WgXcQ | -// | 2023-01-14 10:23:41 +0000 GMT | 2 | NEVER | gonna | Let | You | down@example.org | | -// | 2023-01-14 10:25:41 +0000 GMT | 1 | NEVER | gonna | Give | You | up@example.org | | +// | 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 | | // +-------------------------------+------------------+----------------+----------------+----------------+----------------+----------------------------+---------------------------------------------+ // // 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. 🌟 diff --git a/scripts/pre-commit b/scripts/pre-commit new file mode 100755 index 00000000..3333a59c --- /dev/null +++ b/scripts/pre-commit @@ -0,0 +1,18 @@ +#!/bin/sh +# +# Git pre-commit hook that regenerates the config JSON schema +# when src/types/config.ts is modified. +# +# To install, run from the repository root: +# cp scripts/pre-commit .git/hooks/pre-commit +# chmod +x .git/hooks/pre-commit + +STAGED=$(git diff --cached --name-only) + +if echo "$STAGED" | grep -q "src/types/config.ts"; then + echo "Config types changed — regenerating config JSON schema..." + yarn generate:config-schema + + git add src/schemas/config-schema.json pkg/configschema/config_schema.json + echo "Config JSON schema updated and staged." +fi From f0f5b4f596187d20748564559da0b98173b5b78f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Mar 2026 11:26:41 +0000 Subject: [PATCH 4/8] Add explicit permissions to check-config-schema workflow Co-authored-by: yesoreyeram <153843+yesoreyeram@users.noreply.github.com> --- .github/workflows/check-config-schema.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/check-config-schema.yml b/.github/workflows/check-config-schema.yml index dea76352..4aee6dfd 100644 --- a/.github/workflows/check-config-schema.yml +++ b/.github/workflows/check-config-schema.yml @@ -1,5 +1,8 @@ name: Check Config Schema +permissions: + contents: read + on: pull_request: paths: From a1411141c0bba46b7590a7eef10a1adbf507beb4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Mar 2026 11:48:37 +0000 Subject: [PATCH 5/8] Address review: revert golden files, use schema/config path, add local import guard - Revert all irrelevant golden file changes - Rename schema file path to schema/config (src/schema/config.json, pkg/configschema/config.json) - Use schema/config as the resource call path - Add guard in generate script to reject local file imports in config.ts - Add guard step in CI workflow to catch local imports early Co-authored-by: yesoreyeram <153843+yesoreyeram@users.noreply.github.com> --- .github/workflows/check-config-schema.yml | 9 ++++++++- .../{config_schema.json => config.json} | 0 pkg/configschema/configschema.go | 2 +- pkg/github/testdata/commits.golden.jsonc | 16 +++++++-------- pkg/github/testdata/issues.golden.jsonc | 18 ++++++++--------- pkg/github/testdata/milestones.golden.jsonc | 18 ++++++++--------- .../pull_request_reviews.golden.jsonc | 20 +++++++++---------- .../testdata/pull_requests.golden.jsonc | 18 ++++++++--------- pkg/github/testdata/releases.golden.jsonc | 16 +++++++-------- pkg/github/testdata/repositories.golden.jsonc | 16 +++++++-------- pkg/github/testdata/stargazers.golden.jsonc | 6 +++--- pkg/github/testdata/tags.golden.jsonc | 16 +++++++-------- pkg/plugin/instance.go | 2 +- scripts/generate-config-schema.ts | 15 +++++++++++--- scripts/pre-commit | 2 +- .../config-schema.json => schema/config.json} | 0 16 files changed, 95 insertions(+), 79 deletions(-) rename pkg/configschema/{config_schema.json => config.json} (100%) rename src/{schemas/config-schema.json => schema/config.json} (100%) diff --git a/.github/workflows/check-config-schema.yml b/.github/workflows/check-config-schema.yml index 4aee6dfd..2eafb7e4 100644 --- a/.github/workflows/check-config-schema.yml +++ b/.github/workflows/check-config-schema.yml @@ -30,12 +30,19 @@ jobs: - name: Install dependencies run: yarn install --immutable + - name: Guard against local imports in config types + run: | + if grep -Pn '^\s*import\s.*from\s+['"'"'"]\.\.' src/types/config.ts; then + echo "::error::src/types/config.ts must not import from local files. All config types must be self-contained." + exit 1 + fi + - name: Generate config schema run: yarn generate:config-schema - name: Check for uncommitted schema changes run: | - if ! git diff --exit-code src/schemas/config-schema.json pkg/configschema/config_schema.json; then + if ! git diff --exit-code src/schema/config.json pkg/configschema/config.json; then echo "::error::Config schema is out of date. Run 'yarn generate:config-schema' and commit the changes." exit 1 fi diff --git a/pkg/configschema/config_schema.json b/pkg/configschema/config.json similarity index 100% rename from pkg/configschema/config_schema.json rename to pkg/configschema/config.json diff --git a/pkg/configschema/configschema.go b/pkg/configschema/configschema.go index 470fcea9..afd03663 100644 --- a/pkg/configschema/configschema.go +++ b/pkg/configschema/configschema.go @@ -4,5 +4,5 @@ import ( _ "embed" ) -//go:embed config_schema.json +//go:embed config.json var ConfigSchemaJSON []byte diff --git a/pkg/github/testdata/commits.golden.jsonc b/pkg/github/testdata/commits.golden.jsonc index 6bfcce5c..f341b555 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 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 | -// +----------------+-----------------+--------------------+--------------------+----------------------+-------------------------------+-------------------------------+----------------+ +// +----------------+-----------------+--------------------+--------------------+----------------------+---------------------------------+---------------------------------+----------------+ +// | 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 | +// +----------------+-----------------+--------------------+--------------------+----------------------+---------------------------------+---------------------------------+----------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/github/testdata/issues.golden.jsonc b/pkg/github/testdata/issues.golden.jsonc index 1ff75660..89c98fbd 100644 --- a/pkg/github/testdata/issues.golden.jsonc +++ b/pkg/github/testdata/issues.golden.jsonc @@ -3,15 +3,15 @@ // Frame[0] // Name: issues // Dimensions: 13 Fields by 3 Rows -// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+-------------------------------+-------------------------------+-------------------------------+-------------------------+----------------------------+-----------------+ -// | Name: title | Name: author | Name: author_company | Name: repo | Name: number | Name: state | Name: closed | Name: created_at | Name: closed_at | Name: updated_at | Name: labels | Name: assignees | Name: milestone | -// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | -// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []int64 | Type: []string | Type: []bool | Type: []time.Time | Type: []*time.Time | Type: []time.Time | Type: []json.RawMessage | Type: []json.RawMessage | Type: []*string | -// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+-------------------------------+-------------------------------+-------------------------------+-------------------------+----------------------------+-----------------+ -// | Issue #1 | firstUser | ACME Corp | grafana/grafana | 1 | open | false | 2020-08-25 16:21:56 +0000 UTC | null | 2020-08-25 16:21:56 +0000 UTC | ["bug","help wanted"] | ["firstUser","secondUser"] | v1.0 | -// | Issue #2 | secondUser | ACME Corp | grafana/grafana | 2 | closed | 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"] | v1.0 | -// | Issue #3 | firstUser | ACME Corp | grafana/grafana | 3 | open | false | 2020-08-25 16:21:56 +0000 UTC | null | 2020-08-25 16:21:56 +0000 UTC | [] | [] | null | -// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+-------------------------------+-------------------------------+-------------------------------+-------------------------+----------------------------+-----------------+ +// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+---------------------------------+---------------------------------+---------------------------------+-------------------------+----------------------------+-----------------+ +// | Name: title | Name: author | Name: author_company | Name: repo | Name: number | Name: state | Name: closed | Name: created_at | Name: closed_at | Name: updated_at | Name: labels | Name: assignees | Name: milestone | +// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | +// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []int64 | Type: []string | Type: []bool | Type: []time.Time | Type: []*time.Time | Type: []time.Time | Type: []json.RawMessage | Type: []json.RawMessage | Type: []*string | +// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+---------------------------------+---------------------------------+---------------------------------+-------------------------+----------------------------+-----------------+ +// | Issue #1 | firstUser | ACME Corp | grafana/grafana | 1 | open | false | 2020-08-25 16:21:56 +0000 +0000 | null | 2020-08-25 16:21:56 +0000 +0000 | ["bug","help wanted"] | ["firstUser","secondUser"] | v1.0 | +// | Issue #2 | secondUser | ACME Corp | grafana/grafana | 2 | closed | 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"] | v1.0 | +// | Issue #3 | firstUser | ACME Corp | grafana/grafana | 3 | open | false | 2020-08-25 16:21:56 +0000 +0000 | null | 2020-08-25 16:21:56 +0000 +0000 | [] | [] | null | +// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+---------------------------------+---------------------------------+---------------------------------+-------------------------+----------------------------+-----------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/github/testdata/milestones.golden.jsonc b/pkg/github/testdata/milestones.golden.jsonc index a145267c..2a4ec5db 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 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 | -// +------------------+----------------+--------------+----------------+-------------------------------+-------------------------------+-------------------------------+ +// +------------------+----------------+--------------+----------------+---------------------------------+---------------------------------+---------------------------------+ +// | 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 | +// +------------------+----------------+--------------+----------------+---------------------------------+---------------------------------+---------------------------------+ // // // 🌟 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 be0d2886..b8264c69 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 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 | -// +---------------------------+--------------------------+--------------------------+------------------------------------------------------+--------------------------------+---------------------------------+---------------------------------+-----------------------------------+---------------------------+--------------------------+---------------------------+---------------------------+-----------------------------+----------------------------------------------------------------------------------+--------------------+----------------------------+-------------------------------+-------------------------------+ +// +---------------------------+--------------------------+--------------------------+------------------------------------------------------+--------------------------------+---------------------------------+---------------------------------+-----------------------------------+---------------------------+--------------------------+---------------------------+---------------------------+-----------------------------+----------------------------------------------------------------------------------+--------------------+----------------------------+---------------------------------+---------------------------------+ +// | 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 | +// +---------------------------+--------------------------+--------------------------+------------------------------------------------------+--------------------------------+---------------------------------+---------------------------------+-----------------------------------+---------------------------+--------------------------+---------------------------+---------------------------+-----------------------------+----------------------------------------------------------------------------------+--------------------+----------------------------+---------------------------------+---------------------------------+ // // // 🌟 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 f9d96967..3dc085d9 100644 --- a/pkg/github/testdata/pull_requests.golden.jsonc +++ b/pkg/github/testdata/pull_requests.golden.jsonc @@ -3,15 +3,15 @@ // Frame[0] // Name: pull_requests // 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 | [] | -// +---------------+----------------+------------------------------------------------------+-----------------+-----------------+---------------------------+----------------+-------------------+--------------------+--------------------+----------------------+--------------+----------------+--------------+--------------+-----------------+-------------------------------+-------------------------------+----------------------+-----------------------+-----------------------+-------------------------+-------------------------------+-------------------------------+-----------------+-------------------------+ +// +---------------+----------------+------------------------------------------------------+-----------------+-----------------+---------------------------+----------------+-------------------+--------------------+--------------------+----------------------+--------------+----------------+--------------+--------------+-----------------+---------------------------------+---------------------------------+----------------------+-----------------------+-----------------------+-------------------------+---------------------------------+---------------------------------+-----------------+-------------------------+ +// | 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 +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 | ["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 +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 | ["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 +0000 | null | null | null | null | 2020-08-25 18:21:56 +0000 +0000 | 2020-08-25 16:21:56 +0000 +0000 | 6000 | [] | +// +---------------+----------------+------------------------------------------------------+-----------------+-----------------+---------------------------+----------------+-------------------+--------------------+--------------------+----------------------+--------------+----------------+--------------+--------------+-----------------+---------------------------------+---------------------------------+----------------------+-----------------------+-----------------------+-------------------------+---------------------------------+---------------------------------+-----------------+-------------------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/github/testdata/releases.golden.jsonc b/pkg/github/testdata/releases.golden.jsonc index ab36f5e7..315cfdc9 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 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 | -// +----------------+------------------+----------------+---------------------+----------------+----------------------------+-------------------------------+-------------------------------+ +// +----------------+------------------+----------------+---------------------+----------------+----------------------------+---------------------------------+---------------------------------+ +// | 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 | +// +----------------+------------------+----------------+---------------------+----------------+----------------------------+---------------------------------+---------------------------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/github/testdata/repositories.golden.jsonc b/pkg/github/testdata/repositories.golden.jsonc index 2742c235..061d7d87 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 UTC | -// | loki | grafana | grafana/loki | github.com/grafana/loki | 12 | true | true | false | 2020-08-25 16:21:56 +0000 UTC | -// +----------------+----------------+-----------------------+----------------------------+---------------+---------------+-----------------+------------------+-------------------------------+ +// +----------------+----------------+-----------------------+----------------------------+---------------+---------------+-----------------+------------------+---------------------------------+ +// | 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 | +// +----------------+----------------+-----------------------+----------------------------+---------------+---------------+-----------------+------------------+---------------------------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/github/testdata/stargazers.golden.jsonc b/pkg/github/testdata/stargazers.golden.jsonc index c681abe3..c20601d1 100644 --- a/pkg/github/testdata/stargazers.golden.jsonc +++ b/pkg/github/testdata/stargazers.golden.jsonc @@ -14,9 +14,9 @@ // | 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 | | +// | 2023-01-14 10:21:41 +0000 GMT | 3 | NEVER | gonna | Run | Around | and_desert_you@example.org | https://www.youtube.com/watch?v=dQw4w9WgXcQ | +// | 2023-01-14 10:23:41 +0000 GMT | 2 | NEVER | gonna | Let | You | down@example.org | | +// | 2023-01-14 10:25:41 +0000 GMT | 1 | NEVER | gonna | Give | You | up@example.org | | // +-------------------------------+------------------+----------------+----------------+----------------+----------------+----------------------------+---------------------------------------------+ // // diff --git a/pkg/github/testdata/tags.golden.jsonc b/pkg/github/testdata/tags.golden.jsonc index 7071a1e0..e3e3ac7f 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 UTC | -// | v1.1.0 | | First Committer | firstCommitter | first@example.com | ACME Corp | 2020-08-25 16:21:56 +0000 UTC | -// +----------------+----------------+-----------------+--------------------+--------------------+----------------------+-------------------------------+ +// +----------------+----------------+-----------------+--------------------+--------------------+----------------------+---------------------------------+ +// | 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 | +// +----------------+----------------+-----------------+--------------------+--------------------+----------------------+---------------------------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/plugin/instance.go b/pkg/plugin/instance.go index 2450156f..6378f376 100644 --- a/pkg/plugin/instance.go +++ b/pkg/plugin/instance.go @@ -21,7 +21,7 @@ type GitHubInstanceWithSchema struct { } func (g *GitHubInstanceWithSchema) CallResource(ctx context.Context, req *backend.CallResourceRequest, sender backend.CallResourceResponseSender) error { - if req.Path == "config-schema" { + if req.Path == "schema/config" { return sender.Send(&backend.CallResourceResponse{ Status: http.StatusOK, Headers: map[string][]string{"Content-Type": {"application/json"}}, diff --git a/scripts/generate-config-schema.ts b/scripts/generate-config-schema.ts index f8bfb22d..c0fb8114 100644 --- a/scripts/generate-config-schema.ts +++ b/scripts/generate-config-schema.ts @@ -4,6 +4,15 @@ import * as path from 'path'; import { GitHubDataSourceOptionsSchema, GitHubSecureJsonDataSchema } from '../src/types/config'; +// Guard: ensure config.ts only imports from external packages (no local file imports) +const configSource = fs.readFileSync(path.resolve(__dirname, '..', 'src', 'types', 'config.ts'), 'utf-8'); +const localImportPattern = /(?:^|\n)\s*import\s.*from\s+['"]\.\.?\//; +if (localImportPattern.test(configSource)) { + console.error('Error: src/types/config.ts must not import from local files.'); + console.error('All config types must be self-contained in a single file to ensure schema generation is reliable.'); + process.exit(1); +} + const configSchema = { $schema: 'https://json-schema.org/draft/2020-12/schema', title: 'GitHubDataSourceConfig', @@ -17,14 +26,14 @@ const configSchema = { const schemaJSON = JSON.stringify(configSchema, null, 2) + '\n'; -// Write to src/schemas/ for frontend consumers -const frontendPath = path.resolve(__dirname, '..', 'src', 'schemas', 'config-schema.json'); +// Write to src/schema/ for frontend consumers +const frontendPath = path.resolve(__dirname, '..', 'src', 'schema', 'config.json'); fs.mkdirSync(path.dirname(frontendPath), { recursive: true }); fs.writeFileSync(frontendPath, schemaJSON); console.log(`Config JSON schema written to ${frontendPath}`); // Write to pkg/configschema/ for Go backend embedding -const backendPath = path.resolve(__dirname, '..', 'pkg', 'configschema', 'config_schema.json'); +const backendPath = path.resolve(__dirname, '..', 'pkg', 'configschema', 'config.json'); fs.mkdirSync(path.dirname(backendPath), { recursive: true }); fs.writeFileSync(backendPath, schemaJSON); console.log(`Config JSON schema written to ${backendPath}`); diff --git a/scripts/pre-commit b/scripts/pre-commit index 3333a59c..b53ab56d 100755 --- a/scripts/pre-commit +++ b/scripts/pre-commit @@ -13,6 +13,6 @@ if echo "$STAGED" | grep -q "src/types/config.ts"; then echo "Config types changed — regenerating config JSON schema..." yarn generate:config-schema - git add src/schemas/config-schema.json pkg/configschema/config_schema.json + git add src/schema/config.json pkg/configschema/config.json echo "Config JSON schema updated and staged." fi diff --git a/src/schemas/config-schema.json b/src/schema/config.json similarity index 100% rename from src/schemas/config-schema.json rename to src/schema/config.json From d22ba252ebdb22901071c8472ac6317393e3a924 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Mar 2026 12:05:15 +0000 Subject: [PATCH 6/8] Remove duplicate schema from src/, use ESLint no-restricted-imports guard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove src/schema/config.json — schema only lives in pkg/configschema/config.json - Replace custom import guard script with ESLint no-restricted-imports rule in eslint.config.mjs, scoped to src/types/config.ts - CI workflow uses yarn lint to enforce the import guard - Simplify generate script to single output location - Update pre-commit hook to only stage pkg/configschema/config.json Co-authored-by: yesoreyeram <153843+yesoreyeram@users.noreply.github.com> --- .github/workflows/check-config-schema.yml | 10 +- eslint.config.mjs | 17 ++ pkg/github/testdata/commits.golden.jsonc | 16 +- pkg/github/testdata/issues.golden.jsonc | 18 +-- pkg/github/testdata/milestones.golden.jsonc | 18 +-- .../pull_request_reviews.golden.jsonc | 20 +-- .../testdata/pull_requests.golden.jsonc | 18 +-- pkg/github/testdata/releases.golden.jsonc | 16 +- pkg/github/testdata/repositories.golden.jsonc | 16 +- pkg/github/testdata/stargazers.golden.jsonc | 6 +- pkg/github/testdata/tags.golden.jsonc | 16 +- scripts/generate-config-schema.ts | 24 +-- scripts/pre-commit | 2 +- src/schema/config.json | 153 ------------------ 14 files changed, 97 insertions(+), 253 deletions(-) delete mode 100644 src/schema/config.json diff --git a/.github/workflows/check-config-schema.yml b/.github/workflows/check-config-schema.yml index 2eafb7e4..94c3416d 100644 --- a/.github/workflows/check-config-schema.yml +++ b/.github/workflows/check-config-schema.yml @@ -30,19 +30,15 @@ jobs: - name: Install dependencies run: yarn install --immutable - - name: Guard against local imports in config types - run: | - if grep -Pn '^\s*import\s.*from\s+['"'"'"]\.\.' src/types/config.ts; then - echo "::error::src/types/config.ts must not import from local files. All config types must be self-contained." - exit 1 - fi + - name: Lint config types (import guard) + run: yarn lint --no-cache -- src/types/config.ts - name: Generate config schema run: yarn generate:config-schema - name: Check for uncommitted schema changes run: | - if ! git diff --exit-code src/schema/config.json pkg/configschema/config.json; then + if ! git diff --exit-code pkg/configschema/config.json; then echo "::error::Config schema is out of date. Run 'yarn generate:config-schema' and commit the changes." exit 1 fi diff --git a/eslint.config.mjs b/eslint.config.mjs index 39f4f1ca..3f5bc546 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -28,4 +28,21 @@ export default defineConfig([ ], }, ...baseConfig, + { + files: ['src/types/config.ts'], + rules: { + 'no-restricted-imports': [ + 'error', + { + patterns: [ + { + group: ['./*', '../*'], + message: + 'src/types/config.ts must be self-contained with no local imports to ensure reliable schema generation.', + }, + ], + }, + ], + }, + }, ]); 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 89c98fbd..1ff75660 100644 --- a/pkg/github/testdata/issues.golden.jsonc +++ b/pkg/github/testdata/issues.golden.jsonc @@ -3,15 +3,15 @@ // Frame[0] // Name: issues // Dimensions: 13 Fields by 3 Rows -// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+---------------------------------+---------------------------------+---------------------------------+-------------------------+----------------------------+-----------------+ -// | Name: title | Name: author | Name: author_company | Name: repo | Name: number | Name: state | Name: closed | Name: created_at | Name: closed_at | Name: updated_at | Name: labels | Name: assignees | Name: milestone | -// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | -// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []int64 | Type: []string | Type: []bool | Type: []time.Time | Type: []*time.Time | Type: []time.Time | Type: []json.RawMessage | Type: []json.RawMessage | Type: []*string | -// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+---------------------------------+---------------------------------+---------------------------------+-------------------------+----------------------------+-----------------+ -// | Issue #1 | firstUser | ACME Corp | grafana/grafana | 1 | open | false | 2020-08-25 16:21:56 +0000 +0000 | null | 2020-08-25 16:21:56 +0000 +0000 | ["bug","help wanted"] | ["firstUser","secondUser"] | v1.0 | -// | Issue #2 | secondUser | ACME Corp | grafana/grafana | 2 | closed | 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"] | v1.0 | -// | Issue #3 | firstUser | ACME Corp | grafana/grafana | 3 | open | false | 2020-08-25 16:21:56 +0000 +0000 | null | 2020-08-25 16:21:56 +0000 +0000 | [] | [] | null | -// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+---------------------------------+---------------------------------+---------------------------------+-------------------------+----------------------------+-----------------+ +// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+-------------------------------+-------------------------------+-------------------------------+-------------------------+----------------------------+-----------------+ +// | Name: title | Name: author | Name: author_company | Name: repo | Name: number | Name: state | Name: closed | Name: created_at | Name: closed_at | Name: updated_at | Name: labels | Name: assignees | Name: milestone | +// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | +// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []int64 | Type: []string | Type: []bool | Type: []time.Time | Type: []*time.Time | Type: []time.Time | Type: []json.RawMessage | Type: []json.RawMessage | Type: []*string | +// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+-------------------------------+-------------------------------+-------------------------------+-------------------------+----------------------------+-----------------+ +// | Issue #1 | firstUser | ACME Corp | grafana/grafana | 1 | open | false | 2020-08-25 16:21:56 +0000 UTC | null | 2020-08-25 16:21:56 +0000 UTC | ["bug","help wanted"] | ["firstUser","secondUser"] | v1.0 | +// | Issue #2 | secondUser | ACME Corp | grafana/grafana | 2 | closed | 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"] | v1.0 | +// | Issue #3 | firstUser | ACME Corp | grafana/grafana | 3 | open | false | 2020-08-25 16:21:56 +0000 UTC | null | 2020-08-25 16:21:56 +0000 UTC | [] | [] | null | +// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+-------------------------------+-------------------------------+-------------------------------+-------------------------+----------------------------+-----------------+ // // // 🌟 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 3dc085d9..f9d96967 100644 --- a/pkg/github/testdata/pull_requests.golden.jsonc +++ b/pkg/github/testdata/pull_requests.golden.jsonc @@ -3,15 +3,15 @@ // Frame[0] // Name: pull_requests // 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 +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 | ["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 +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 | ["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 +0000 | null | null | null | null | 2020-08-25 18:21:56 +0000 +0000 | 2020-08-25 16:21:56 +0000 +0000 | 6000 | [] | -// +---------------+----------------+------------------------------------------------------+-----------------+-----------------+---------------------------+----------------+-------------------+--------------------+--------------------+----------------------+--------------+----------------+--------------+--------------+-----------------+---------------------------------+---------------------------------+----------------------+-----------------------+-----------------------+-------------------------+---------------------------------+---------------------------------+-----------------+-------------------------+ +// +---------------+----------------+------------------------------------------------------+-----------------+-----------------+---------------------------+----------------+-------------------+--------------------+--------------------+----------------------+--------------+----------------+--------------+--------------+-----------------+-------------------------------+-------------------------------+----------------------+-----------------------+-----------------------+-------------------------+-------------------------------+-------------------------------+-----------------+-------------------------+ +// | 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. 🌟 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 c20601d1..c681abe3 100644 --- a/pkg/github/testdata/stargazers.golden.jsonc +++ b/pkg/github/testdata/stargazers.golden.jsonc @@ -14,9 +14,9 @@ // | 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 GMT | 3 | NEVER | gonna | Run | Around | and_desert_you@example.org | https://www.youtube.com/watch?v=dQw4w9WgXcQ | -// | 2023-01-14 10:23:41 +0000 GMT | 2 | NEVER | gonna | Let | You | down@example.org | | -// | 2023-01-14 10:25:41 +0000 GMT | 1 | NEVER | gonna | Give | You | up@example.org | | +// | 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 | | // +-------------------------------+------------------+----------------+----------------+----------------+----------------+----------------------------+---------------------------------------------+ // // 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. 🌟 diff --git a/scripts/generate-config-schema.ts b/scripts/generate-config-schema.ts index c0fb8114..d586f6d0 100644 --- a/scripts/generate-config-schema.ts +++ b/scripts/generate-config-schema.ts @@ -4,15 +4,6 @@ import * as path from 'path'; import { GitHubDataSourceOptionsSchema, GitHubSecureJsonDataSchema } from '../src/types/config'; -// Guard: ensure config.ts only imports from external packages (no local file imports) -const configSource = fs.readFileSync(path.resolve(__dirname, '..', 'src', 'types', 'config.ts'), 'utf-8'); -const localImportPattern = /(?:^|\n)\s*import\s.*from\s+['"]\.\.?\//; -if (localImportPattern.test(configSource)) { - console.error('Error: src/types/config.ts must not import from local files.'); - console.error('All config types must be self-contained in a single file to ensure schema generation is reliable.'); - process.exit(1); -} - const configSchema = { $schema: 'https://json-schema.org/draft/2020-12/schema', title: 'GitHubDataSourceConfig', @@ -26,14 +17,7 @@ const configSchema = { const schemaJSON = JSON.stringify(configSchema, null, 2) + '\n'; -// Write to src/schema/ for frontend consumers -const frontendPath = path.resolve(__dirname, '..', 'src', 'schema', 'config.json'); -fs.mkdirSync(path.dirname(frontendPath), { recursive: true }); -fs.writeFileSync(frontendPath, schemaJSON); -console.log(`Config JSON schema written to ${frontendPath}`); - -// Write to pkg/configschema/ for Go backend embedding -const backendPath = path.resolve(__dirname, '..', 'pkg', 'configschema', 'config.json'); -fs.mkdirSync(path.dirname(backendPath), { recursive: true }); -fs.writeFileSync(backendPath, schemaJSON); -console.log(`Config JSON schema written to ${backendPath}`); +const outPath = path.resolve(__dirname, '..', 'pkg', 'configschema', 'config.json'); +fs.mkdirSync(path.dirname(outPath), { recursive: true }); +fs.writeFileSync(outPath, schemaJSON); +console.log(`Config JSON schema written to ${outPath}`); diff --git a/scripts/pre-commit b/scripts/pre-commit index b53ab56d..f2508c5e 100755 --- a/scripts/pre-commit +++ b/scripts/pre-commit @@ -13,6 +13,6 @@ if echo "$STAGED" | grep -q "src/types/config.ts"; then echo "Config types changed — regenerating config JSON schema..." yarn generate:config-schema - git add src/schema/config.json pkg/configschema/config.json + git add pkg/configschema/config.json echo "Config JSON schema updated and staged." fi diff --git a/src/schema/config.json b/src/schema/config.json deleted file mode 100644 index 78e2dc40..00000000 --- a/src/schema/config.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "$schema": "https://json-schema.org/draft/2020-12/schema", - "title": "GitHubDataSourceConfig", - "description": "Configuration schema for the Grafana GitHub data source plugin", - "type": "object", - "properties": { - "jsonData": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "allOf": [ - { - "anyOf": [ - { - "anyOf": [ - { - "type": "object", - "properties": { - "githubPlan": { - "type": "string", - "const": "github-basic" - }, - "githubUrl": { - "not": {} - } - }, - "required": [ - "githubUrl" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "githubPlan": { - "type": "string", - "const": "github-enterprise-cloud" - }, - "githubUrl": { - "not": {} - } - }, - "required": [ - "githubPlan", - "githubUrl" - ], - "additionalProperties": false - } - ] - }, - { - "type": "object", - "properties": { - "githubPlan": { - "type": "string", - "const": "github-enterprise-server" - }, - "githubUrl": { - "type": "string" - } - }, - "required": [ - "githubPlan", - "githubUrl" - ], - "additionalProperties": false - } - ] - }, - { - "anyOf": [ - { - "type": "object", - "properties": { - "selectedAuthType": { - "type": "string", - "const": "personal-access-token" - }, - "appId": { - "not": {} - }, - "installationId": { - "not": {} - } - }, - "required": [ - "appId", - "installationId" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "selectedAuthType": { - "type": "string", - "const": "github-app" - }, - "appId": { - "type": "string" - }, - "installationId": { - "type": "string" - } - }, - "required": [ - "selectedAuthType", - "appId", - "installationId" - ], - "additionalProperties": false - } - ] - } - ] - }, - "secureJsonData": { - "$schema": "https://json-schema.org/draft/2020-12/schema", - "anyOf": [ - { - "type": "object", - "properties": { - "accessToken": { - "type": "string" - }, - "privateKey": { - "not": {} - } - }, - "required": [ - "accessToken", - "privateKey" - ], - "additionalProperties": false - }, - { - "type": "object", - "properties": { - "accessToken": { - "not": {} - }, - "privateKey": { - "type": "string" - } - }, - "required": [ - "accessToken", - "privateKey" - ], - "additionalProperties": false - } - ] - } - } -} From 731551b6134db0ee051418922e3390bb5ae5c639 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Mar 2026 12:35:29 +0000 Subject: [PATCH 7/8] Rename configschema package to schema, revert golden file changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename pkg/configschema/ to pkg/schema/ (configschema.go → config.go) - Update all references in instance.go, generate script, CI workflow, pre-commit - Revert all golden jsonc file changes to match base branch Co-authored-by: yesoreyeram <153843+yesoreyeram@users.noreply.github.com> --- .github/workflows/check-config-schema.yml | 2 +- pkg/github/testdata/commits.golden.jsonc | 16 +++++++-------- pkg/github/testdata/issues.golden.jsonc | 18 ++++++++--------- pkg/github/testdata/milestones.golden.jsonc | 18 ++++++++--------- .../pull_request_reviews.golden.jsonc | 20 +++++++++---------- .../testdata/pull_requests.golden.jsonc | 18 ++++++++--------- pkg/github/testdata/releases.golden.jsonc | 16 +++++++-------- pkg/github/testdata/repositories.golden.jsonc | 16 +++++++-------- pkg/github/testdata/stargazers.golden.jsonc | 6 +++--- pkg/github/testdata/tags.golden.jsonc | 16 +++++++-------- pkg/plugin/instance.go | 4 ++-- .../configschema.go => schema/config.go} | 2 +- pkg/{configschema => schema}/config.json | 0 scripts/generate-config-schema.ts | 2 +- scripts/pre-commit | 2 +- 15 files changed, 78 insertions(+), 78 deletions(-) rename pkg/{configschema/configschema.go => schema/config.go} (78%) rename pkg/{configschema => schema}/config.json (100%) diff --git a/.github/workflows/check-config-schema.yml b/.github/workflows/check-config-schema.yml index 94c3416d..c2b2948f 100644 --- a/.github/workflows/check-config-schema.yml +++ b/.github/workflows/check-config-schema.yml @@ -38,7 +38,7 @@ jobs: - name: Check for uncommitted schema changes run: | - if ! git diff --exit-code pkg/configschema/config.json; then + if ! git diff --exit-code pkg/schema/config.json; then echo "::error::Config schema is out of date. Run 'yarn generate:config-schema' and commit the changes." exit 1 fi diff --git a/pkg/github/testdata/commits.golden.jsonc b/pkg/github/testdata/commits.golden.jsonc index 6bfcce5c..f341b555 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 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 | -// +----------------+-----------------+--------------------+--------------------+----------------------+-------------------------------+-------------------------------+----------------+ +// +----------------+-----------------+--------------------+--------------------+----------------------+---------------------------------+---------------------------------+----------------+ +// | 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 | +// +----------------+-----------------+--------------------+--------------------+----------------------+---------------------------------+---------------------------------+----------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/github/testdata/issues.golden.jsonc b/pkg/github/testdata/issues.golden.jsonc index 1ff75660..89c98fbd 100644 --- a/pkg/github/testdata/issues.golden.jsonc +++ b/pkg/github/testdata/issues.golden.jsonc @@ -3,15 +3,15 @@ // Frame[0] // Name: issues // Dimensions: 13 Fields by 3 Rows -// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+-------------------------------+-------------------------------+-------------------------------+-------------------------+----------------------------+-----------------+ -// | Name: title | Name: author | Name: author_company | Name: repo | Name: number | Name: state | Name: closed | Name: created_at | Name: closed_at | Name: updated_at | Name: labels | Name: assignees | Name: milestone | -// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | -// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []int64 | Type: []string | Type: []bool | Type: []time.Time | Type: []*time.Time | Type: []time.Time | Type: []json.RawMessage | Type: []json.RawMessage | Type: []*string | -// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+-------------------------------+-------------------------------+-------------------------------+-------------------------+----------------------------+-----------------+ -// | Issue #1 | firstUser | ACME Corp | grafana/grafana | 1 | open | false | 2020-08-25 16:21:56 +0000 UTC | null | 2020-08-25 16:21:56 +0000 UTC | ["bug","help wanted"] | ["firstUser","secondUser"] | v1.0 | -// | Issue #2 | secondUser | ACME Corp | grafana/grafana | 2 | closed | 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"] | v1.0 | -// | Issue #3 | firstUser | ACME Corp | grafana/grafana | 3 | open | false | 2020-08-25 16:21:56 +0000 UTC | null | 2020-08-25 16:21:56 +0000 UTC | [] | [] | null | -// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+-------------------------------+-------------------------------+-------------------------------+-------------------------+----------------------------+-----------------+ +// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+---------------------------------+---------------------------------+---------------------------------+-------------------------+----------------------------+-----------------+ +// | Name: title | Name: author | Name: author_company | Name: repo | Name: number | Name: state | Name: closed | Name: created_at | Name: closed_at | Name: updated_at | Name: labels | Name: assignees | Name: milestone | +// | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | Labels: | +// | Type: []string | Type: []string | Type: []string | Type: []string | Type: []int64 | Type: []string | Type: []bool | Type: []time.Time | Type: []*time.Time | Type: []time.Time | Type: []json.RawMessage | Type: []json.RawMessage | Type: []*string | +// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+---------------------------------+---------------------------------+---------------------------------+-------------------------+----------------------------+-----------------+ +// | Issue #1 | firstUser | ACME Corp | grafana/grafana | 1 | open | false | 2020-08-25 16:21:56 +0000 +0000 | null | 2020-08-25 16:21:56 +0000 +0000 | ["bug","help wanted"] | ["firstUser","secondUser"] | v1.0 | +// | Issue #2 | secondUser | ACME Corp | grafana/grafana | 2 | closed | 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"] | v1.0 | +// | Issue #3 | firstUser | ACME Corp | grafana/grafana | 3 | open | false | 2020-08-25 16:21:56 +0000 +0000 | null | 2020-08-25 16:21:56 +0000 +0000 | [] | [] | null | +// +----------------+----------------+----------------------+-----------------+---------------+----------------+--------------+---------------------------------+---------------------------------+---------------------------------+-------------------------+----------------------------+-----------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/github/testdata/milestones.golden.jsonc b/pkg/github/testdata/milestones.golden.jsonc index a145267c..2a4ec5db 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 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 | -// +------------------+----------------+--------------+----------------+-------------------------------+-------------------------------+-------------------------------+ +// +------------------+----------------+--------------+----------------+---------------------------------+---------------------------------+---------------------------------+ +// | 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 | +// +------------------+----------------+--------------+----------------+---------------------------------+---------------------------------+---------------------------------+ // // // 🌟 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 be0d2886..b8264c69 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 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 | -// +---------------------------+--------------------------+--------------------------+------------------------------------------------------+--------------------------------+---------------------------------+---------------------------------+-----------------------------------+---------------------------+--------------------------+---------------------------+---------------------------+-----------------------------+----------------------------------------------------------------------------------+--------------------+----------------------------+-------------------------------+-------------------------------+ +// +---------------------------+--------------------------+--------------------------+------------------------------------------------------+--------------------------------+---------------------------------+---------------------------------+-----------------------------------+---------------------------+--------------------------+---------------------------+---------------------------+-----------------------------+----------------------------------------------------------------------------------+--------------------+----------------------------+---------------------------------+---------------------------------+ +// | 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 | +// +---------------------------+--------------------------+--------------------------+------------------------------------------------------+--------------------------------+---------------------------------+---------------------------------+-----------------------------------+---------------------------+--------------------------+---------------------------+---------------------------+-----------------------------+----------------------------------------------------------------------------------+--------------------+----------------------------+---------------------------------+---------------------------------+ // // // 🌟 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 f9d96967..3dc085d9 100644 --- a/pkg/github/testdata/pull_requests.golden.jsonc +++ b/pkg/github/testdata/pull_requests.golden.jsonc @@ -3,15 +3,15 @@ // Frame[0] // Name: pull_requests // 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 | [] | -// +---------------+----------------+------------------------------------------------------+-----------------+-----------------+---------------------------+----------------+-------------------+--------------------+--------------------+----------------------+--------------+----------------+--------------+--------------+-----------------+-------------------------------+-------------------------------+----------------------+-----------------------+-----------------------+-------------------------+-------------------------------+-------------------------------+-----------------+-------------------------+ +// +---------------+----------------+------------------------------------------------------+-----------------+-----------------+---------------------------+----------------+-------------------+--------------------+--------------------+----------------------+--------------+----------------+--------------+--------------+-----------------+---------------------------------+---------------------------------+----------------------+-----------------------+-----------------------+-------------------------+---------------------------------+---------------------------------+-----------------+-------------------------+ +// | 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 +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 | ["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 +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 | ["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 +0000 | null | null | null | null | 2020-08-25 18:21:56 +0000 +0000 | 2020-08-25 16:21:56 +0000 +0000 | 6000 | [] | +// +---------------+----------------+------------------------------------------------------+-----------------+-----------------+---------------------------+----------------+-------------------+--------------------+--------------------+----------------------+--------------+----------------+--------------+--------------+-----------------+---------------------------------+---------------------------------+----------------------+-----------------------+-----------------------+-------------------------+---------------------------------+---------------------------------+-----------------+-------------------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/github/testdata/releases.golden.jsonc b/pkg/github/testdata/releases.golden.jsonc index ab36f5e7..315cfdc9 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 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 | -// +----------------+------------------+----------------+---------------------+----------------+----------------------------+-------------------------------+-------------------------------+ +// +----------------+------------------+----------------+---------------------+----------------+----------------------------+---------------------------------+---------------------------------+ +// | 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 | +// +----------------+------------------+----------------+---------------------+----------------+----------------------------+---------------------------------+---------------------------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/github/testdata/repositories.golden.jsonc b/pkg/github/testdata/repositories.golden.jsonc index 2742c235..061d7d87 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 UTC | -// | loki | grafana | grafana/loki | github.com/grafana/loki | 12 | true | true | false | 2020-08-25 16:21:56 +0000 UTC | -// +----------------+----------------+-----------------------+----------------------------+---------------+---------------+-----------------+------------------+-------------------------------+ +// +----------------+----------------+-----------------------+----------------------------+---------------+---------------+-----------------+------------------+---------------------------------+ +// | 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 | +// +----------------+----------------+-----------------------+----------------------------+---------------+---------------+-----------------+------------------+---------------------------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/github/testdata/stargazers.golden.jsonc b/pkg/github/testdata/stargazers.golden.jsonc index c681abe3..c20601d1 100644 --- a/pkg/github/testdata/stargazers.golden.jsonc +++ b/pkg/github/testdata/stargazers.golden.jsonc @@ -14,9 +14,9 @@ // | 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 | | +// | 2023-01-14 10:21:41 +0000 GMT | 3 | NEVER | gonna | Run | Around | and_desert_you@example.org | https://www.youtube.com/watch?v=dQw4w9WgXcQ | +// | 2023-01-14 10:23:41 +0000 GMT | 2 | NEVER | gonna | Let | You | down@example.org | | +// | 2023-01-14 10:25:41 +0000 GMT | 1 | NEVER | gonna | Give | You | up@example.org | | // +-------------------------------+------------------+----------------+----------------+----------------+----------------+----------------------------+---------------------------------------------+ // // diff --git a/pkg/github/testdata/tags.golden.jsonc b/pkg/github/testdata/tags.golden.jsonc index 7071a1e0..e3e3ac7f 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 UTC | -// | v1.1.0 | | First Committer | firstCommitter | first@example.com | ACME Corp | 2020-08-25 16:21:56 +0000 UTC | -// +----------------+----------------+-----------------+--------------------+--------------------+----------------------+-------------------------------+ +// +----------------+----------------+-----------------+--------------------+--------------------+----------------------+---------------------------------+ +// | 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 | +// +----------------+----------------+-----------------+--------------------+--------------------+----------------------+---------------------------------+ // // // 🌟 This was machine generated. Do not edit. 🌟 diff --git a/pkg/plugin/instance.go b/pkg/plugin/instance.go index 6378f376..99048fe3 100644 --- a/pkg/plugin/instance.go +++ b/pkg/plugin/instance.go @@ -9,7 +9,7 @@ import ( "github.com/grafana/grafana-plugin-sdk-go/backend/instancemgmt" schemas "github.com/grafana/schemads" - "github.com/grafana/github-datasource/pkg/configschema" + "github.com/grafana/github-datasource/pkg/schema" "github.com/grafana/github-datasource/pkg/github" "github.com/grafana/github-datasource/pkg/models" ) @@ -25,7 +25,7 @@ func (g *GitHubInstanceWithSchema) CallResource(ctx context.Context, req *backen return sender.Send(&backend.CallResourceResponse{ Status: http.StatusOK, Headers: map[string][]string{"Content-Type": {"application/json"}}, - Body: configschema.ConfigSchemaJSON, + Body: schema.ConfigSchemaJSON, }) } return g.SchemaDatasource.CallResource(ctx, req, sender) diff --git a/pkg/configschema/configschema.go b/pkg/schema/config.go similarity index 78% rename from pkg/configschema/configschema.go rename to pkg/schema/config.go index afd03663..075f3f21 100644 --- a/pkg/configschema/configschema.go +++ b/pkg/schema/config.go @@ -1,4 +1,4 @@ -package configschema +package schema import ( _ "embed" diff --git a/pkg/configschema/config.json b/pkg/schema/config.json similarity index 100% rename from pkg/configschema/config.json rename to pkg/schema/config.json diff --git a/scripts/generate-config-schema.ts b/scripts/generate-config-schema.ts index d586f6d0..954e1074 100644 --- a/scripts/generate-config-schema.ts +++ b/scripts/generate-config-schema.ts @@ -17,7 +17,7 @@ const configSchema = { const schemaJSON = JSON.stringify(configSchema, null, 2) + '\n'; -const outPath = path.resolve(__dirname, '..', 'pkg', 'configschema', 'config.json'); +const outPath = path.resolve(__dirname, '..', 'pkg', 'schema', 'config.json'); fs.mkdirSync(path.dirname(outPath), { recursive: true }); fs.writeFileSync(outPath, schemaJSON); console.log(`Config JSON schema written to ${outPath}`); diff --git a/scripts/pre-commit b/scripts/pre-commit index f2508c5e..f19acee7 100755 --- a/scripts/pre-commit +++ b/scripts/pre-commit @@ -13,6 +13,6 @@ if echo "$STAGED" | grep -q "src/types/config.ts"; then echo "Config types changed — regenerating config JSON schema..." yarn generate:config-schema - git add pkg/configschema/config.json + git add pkg/schema/config.json echo "Config JSON schema updated and staged." fi From bb1726db3ff1e92a0f163aec9b707cf1101c532a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 16 Mar 2026 14:50:10 +0000 Subject: [PATCH 8/8] Add descriptions to all Zod config schema fields for JSON schema generation Co-authored-by: yesoreyeram <153843+yesoreyeram@users.noreply.github.com> --- pkg/schema/config.json | 71 ++++++++++++++++++++++++++++-------------- src/types/config.ts | 53 +++++++++++++++---------------- 2 files changed, 75 insertions(+), 49 deletions(-) diff --git a/pkg/schema/config.json b/pkg/schema/config.json index 78e2dc40..cbe6dcaf 100644 --- a/pkg/schema/config.json +++ b/pkg/schema/config.json @@ -15,34 +15,40 @@ "type": "object", "properties": { "githubPlan": { + "description": "GitHub plan type (basic)", "type": "string", "const": "github-basic" }, "githubUrl": { - "not": {} + "not": {}, + "description": "Not applicable for GitHub basic plan" } }, "required": [ "githubUrl" ], - "additionalProperties": false + "additionalProperties": false, + "description": "Configuration for GitHub basic plan" }, { "type": "object", "properties": { "githubPlan": { "type": "string", - "const": "github-enterprise-cloud" + "const": "github-enterprise-cloud", + "description": "GitHub plan type (Enterprise Cloud)" }, "githubUrl": { - "not": {} + "not": {}, + "description": "Not applicable for GitHub Enterprise Cloud" } }, "required": [ "githubPlan", "githubUrl" ], - "additionalProperties": false + "additionalProperties": false, + "description": "Configuration for GitHub Enterprise Cloud plan" } ] }, @@ -51,17 +57,20 @@ "properties": { "githubPlan": { "type": "string", - "const": "github-enterprise-server" + "const": "github-enterprise-server", + "description": "GitHub plan type (Enterprise Server)" }, "githubUrl": { - "type": "string" + "type": "string", + "description": "The URL of the GitHub Enterprise Server instance" } }, "required": [ "githubPlan", "githubUrl" ], - "additionalProperties": false + "additionalProperties": false, + "description": "Configuration for GitHub Enterprise Server plan" } ] }, @@ -71,34 +80,41 @@ "type": "object", "properties": { "selectedAuthType": { + "description": "Authentication type (Personal Access Token)", "type": "string", "const": "personal-access-token" }, "appId": { - "not": {} + "not": {}, + "description": "Not applicable for PAT authentication" }, "installationId": { - "not": {} + "not": {}, + "description": "Not applicable for PAT authentication" } }, "required": [ "appId", "installationId" ], - "additionalProperties": false + "additionalProperties": false, + "description": "Authentication options for Personal Access Token" }, { "type": "object", "properties": { "selectedAuthType": { "type": "string", - "const": "github-app" + "const": "github-app", + "description": "Authentication type (GitHub App)" }, "appId": { - "type": "string" + "type": "string", + "description": "The GitHub App ID" }, "installationId": { - "type": "string" + "type": "string", + "description": "The GitHub App installation ID" } }, "required": [ @@ -106,11 +122,13 @@ "appId", "installationId" ], - "additionalProperties": false + "additionalProperties": false, + "description": "Authentication options for GitHub App" } ] } - ] + ], + "description": "GitHub data source configuration options (jsonData)" }, "secureJsonData": { "$schema": "https://json-schema.org/draft/2020-12/schema", @@ -119,35 +137,42 @@ "type": "object", "properties": { "accessToken": { - "type": "string" + "type": "string", + "description": "Personal access token for GitHub API authentication" }, "privateKey": { - "not": {} + "not": {}, + "description": "Not applicable for PAT authentication" } }, "required": [ "accessToken", "privateKey" ], - "additionalProperties": false + "additionalProperties": false, + "description": "Secure data for Personal Access Token authentication" }, { "type": "object", "properties": { "accessToken": { - "not": {} + "not": {}, + "description": "Not applicable for GitHub App authentication" }, "privateKey": { - "type": "string" + "type": "string", + "description": "Private key for GitHub App authentication (PEM format)" } }, "required": [ "accessToken", "privateKey" ], - "additionalProperties": false + "additionalProperties": false, + "description": "Secure data for GitHub App authentication" } - ] + ], + "description": "Secure JSON data for GitHub data source authentication (secureJsonData)" } } } diff --git a/src/types/config.ts b/src/types/config.ts index 058ee4fb..151eeac3 100644 --- a/src/types/config.ts +++ b/src/types/config.ts @@ -5,10 +5,10 @@ import type { DataSourceJsonData } from '@grafana/schema'; //#region --- License / Plan schemas --- -const GitHubLicenseTypeSchema = z.enum(['github-basic', 'github-enterprise-cloud', 'github-enterprise-server']); +const GitHubLicenseTypeSchema = z.enum(['github-basic', 'github-enterprise-cloud', 'github-enterprise-server']).describe('The GitHub license/plan type'); export type GitHubLicenseType = z.infer; -const GitHubAuthTypeSchema = z.enum(['personal-access-token', 'github-app']); +const GitHubAuthTypeSchema = z.enum(['personal-access-token', 'github-app']).describe('The GitHub authentication method'); export type GitHubAuthType = z.infer; //#endregion @@ -16,19 +16,19 @@ export type GitHubAuthType = z.infer; //#region --- Plan option schemas --- const GitHubDataSourceBasicOptionsSchema = z.object({ - githubPlan: z.literal('github-basic').optional(), - githubUrl: z.never(), -}); + githubPlan: z.literal('github-basic').optional().describe('GitHub plan type (basic)'), + githubUrl: z.never().describe('Not applicable for GitHub basic plan'), +}).describe('Configuration for GitHub basic plan'); const GitHubDataSourceEnterpriseCloudOptionsSchema = z.object({ - githubPlan: z.literal('github-enterprise-cloud'), - githubUrl: z.never(), -}); + githubPlan: z.literal('github-enterprise-cloud').describe('GitHub plan type (Enterprise Cloud)'), + githubUrl: z.never().describe('Not applicable for GitHub Enterprise Cloud'), +}).describe('Configuration for GitHub Enterprise Cloud plan'); const GitHubDataSourceEnterpriseServerOptionsSchema = z.object({ - githubPlan: z.literal('github-enterprise-server'), - githubUrl: z.string(), -}); + githubPlan: z.literal('github-enterprise-server').describe('GitHub plan type (Enterprise Server)'), + githubUrl: z.string().describe('The URL of the GitHub Enterprise Server instance'), +}).describe('Configuration for GitHub Enterprise Server plan'); const GithubDataSourceCommonOptionsSchema = GitHubDataSourceBasicOptionsSchema .or(GitHubDataSourceEnterpriseCloudOptionsSchema) @@ -39,23 +39,23 @@ const GithubDataSourceCommonOptionsSchema = GitHubDataSourceBasicOptionsSchema //#region --- Auth option schemas --- const GitHubDataSourcePATAuthOptionsSchema = z.object({ - selectedAuthType: z.literal('personal-access-token').optional(), - appId: z.never(), - installationId: z.never(), -}); + selectedAuthType: z.literal('personal-access-token').optional().describe('Authentication type (Personal Access Token)'), + appId: z.never().describe('Not applicable for PAT authentication'), + installationId: z.never().describe('Not applicable for PAT authentication'), +}).describe('Authentication options for Personal Access Token'); const GitHubDataSourceGHAppOptionsSchema = z.object({ - selectedAuthType: z.literal('github-app'), - appId: z.string(), - installationId: z.string(), -}); + selectedAuthType: z.literal('github-app').describe('Authentication type (GitHub App)'), + appId: z.string().describe('The GitHub App ID'), + installationId: z.string().describe('The GitHub App installation ID'), +}).describe('Authentication options for GitHub App'); const GithubDataSourceAuthOptionsSchema = GitHubDataSourcePATAuthOptionsSchema .or(GitHubDataSourceGHAppOptionsSchema) //#endregion -export const GitHubDataSourceOptionsSchema = z.intersection(GithubDataSourceCommonOptionsSchema, GithubDataSourceAuthOptionsSchema); +export const GitHubDataSourceOptionsSchema = z.intersection(GithubDataSourceCommonOptionsSchema, GithubDataSourceAuthOptionsSchema).describe('GitHub data source configuration options (jsonData)'); export type GitHubDataSourceOptions = z.infer & DataSourceJsonData; @@ -66,19 +66,20 @@ export type GitHubDataSourceOptions = z.infer;