From 1693506f803b04ec80c75fa1d4b47e5723b607a0 Mon Sep 17 00:00:00 2001 From: askeluv Date: Wed, 13 Mar 2019 11:47:42 +0800 Subject: [PATCH] name -> full_name + fixed error message for missing access token --- .../pipeline/migrations/1552016339539-CreateGithubRepo.ts | 2 +- .../migrations/1552024155243-CreateGithubPullRequest.ts | 2 +- .../pipeline/migrations/1552044685566-CreateGithubFork.ts | 2 +- packages/pipeline/src/data_sources/github/index.ts | 4 ++-- packages/pipeline/src/entities/github_fork.ts | 4 ++-- packages/pipeline/src/entities/github_pull_request.ts | 4 ++-- packages/pipeline/src/entities/github_repo.ts | 4 ++-- packages/pipeline/src/parsers/github/forks.ts | 2 +- packages/pipeline/src/parsers/github/pulls.ts | 2 +- packages/pipeline/src/parsers/github/repo.ts | 2 +- packages/pipeline/src/scripts/pull_github.ts | 2 +- packages/pipeline/test/entities/github_test.ts | 6 +++--- packages/pipeline/test/fixtures/github/api_v3_forks.ts | 2 +- packages/pipeline/test/fixtures/github/api_v3_pulls.ts | 2 +- packages/pipeline/test/fixtures/github/api_v3_repo.ts | 2 +- 15 files changed, 21 insertions(+), 21 deletions(-) diff --git a/packages/pipeline/migrations/1552016339539-CreateGithubRepo.ts b/packages/pipeline/migrations/1552016339539-CreateGithubRepo.ts index 0babf1d19e..a512c3c782 100644 --- a/packages/pipeline/migrations/1552016339539-CreateGithubRepo.ts +++ b/packages/pipeline/migrations/1552016339539-CreateGithubRepo.ts @@ -4,7 +4,7 @@ const table = new Table({ name: 'raw.github_repo', columns: [ { name: 'observed_timestamp', type: 'numeric', isPrimary: true }, - { name: 'name', type: 'varchar', isPrimary: true }, + { name: 'full_name', type: 'varchar', isPrimary: true }, { name: 'created_at', type: 'numeric', isNullable: false }, { name: 'updated_at', type: 'numeric', isNullable: false }, diff --git a/packages/pipeline/migrations/1552024155243-CreateGithubPullRequest.ts b/packages/pipeline/migrations/1552024155243-CreateGithubPullRequest.ts index d0e8ef6908..82ef52a0f1 100644 --- a/packages/pipeline/migrations/1552024155243-CreateGithubPullRequest.ts +++ b/packages/pipeline/migrations/1552024155243-CreateGithubPullRequest.ts @@ -4,7 +4,7 @@ const table = new Table({ name: 'raw.github_pull_request', columns: [ { name: 'observed_timestamp', type: 'numeric', isPrimary: true }, - { name: 'repo_name', type: 'varchar', isPrimary: true }, + { name: 'repo_full_name', type: 'varchar', isPrimary: true }, { name: 'pull_request_number', type: 'numeric', isPrimary: true }, { name: 'created_at', type: 'numeric', isNullable: false }, diff --git a/packages/pipeline/migrations/1552044685566-CreateGithubFork.ts b/packages/pipeline/migrations/1552044685566-CreateGithubFork.ts index 652bd09003..ecad675811 100644 --- a/packages/pipeline/migrations/1552044685566-CreateGithubFork.ts +++ b/packages/pipeline/migrations/1552044685566-CreateGithubFork.ts @@ -4,7 +4,7 @@ const table = new Table({ name: 'raw.github_fork', columns: [ { name: 'observed_timestamp', type: 'numeric', isPrimary: true }, - { name: 'name', type: 'varchar', isPrimary: true }, + { name: 'full_name', type: 'varchar', isPrimary: true }, { name: 'owner_login', type: 'varchar', isPrimary: true }, { name: 'created_at', type: 'numeric', isNullable: false }, diff --git a/packages/pipeline/src/data_sources/github/index.ts b/packages/pipeline/src/data_sources/github/index.ts index c5090900d4..8e71f95fd3 100644 --- a/packages/pipeline/src/data_sources/github/index.ts +++ b/packages/pipeline/src/data_sources/github/index.ts @@ -1,7 +1,7 @@ import { fetchAsync } from '@0x/utils'; export interface GithubRepoResponse { - name: string; + full_name: string; created_at: string; updated_at: string; pushed_at: string; @@ -27,7 +27,7 @@ export interface GithubPullRequestResponse { }; base: { repo: { - name: string; + full_name: string; }; }; } diff --git a/packages/pipeline/src/entities/github_fork.ts b/packages/pipeline/src/entities/github_fork.ts index 0e5326bb6a..db45bfc725 100644 --- a/packages/pipeline/src/entities/github_fork.ts +++ b/packages/pipeline/src/entities/github_fork.ts @@ -7,8 +7,8 @@ export class GithubFork { @PrimaryColumn({ name: 'observed_timestamp', type: 'bigint', transformer: numberToBigIntTransformer }) public observedTimestamp!: number; - @PrimaryColumn({ name: 'name' }) - public name!: string; + @PrimaryColumn({ name: 'full_name' }) + public fullName!: string; @PrimaryColumn({ name: 'owner_login' }) public ownerLogin!: string; diff --git a/packages/pipeline/src/entities/github_pull_request.ts b/packages/pipeline/src/entities/github_pull_request.ts index 8c17ff5ec2..148c1d03c2 100644 --- a/packages/pipeline/src/entities/github_pull_request.ts +++ b/packages/pipeline/src/entities/github_pull_request.ts @@ -7,8 +7,8 @@ export class GithubPullRequest { @PrimaryColumn({ name: 'observed_timestamp', type: 'bigint', transformer: numberToBigIntTransformer }) public observedTimestamp!: number; - @PrimaryColumn({ name: 'repo_name' }) - public repoName!: string; + @PrimaryColumn({ name: 'repo_full_name' }) + public repoFullName!: string; @PrimaryColumn({ name: 'pull_request_number', transformer: numberToBigIntTransformer }) public pullRequestNumber!: number; diff --git a/packages/pipeline/src/entities/github_repo.ts b/packages/pipeline/src/entities/github_repo.ts index c0c81f4d30..9ff60306d6 100644 --- a/packages/pipeline/src/entities/github_repo.ts +++ b/packages/pipeline/src/entities/github_repo.ts @@ -7,8 +7,8 @@ export class GithubRepo { @PrimaryColumn({ name: 'observed_timestamp', type: 'bigint', transformer: numberToBigIntTransformer }) public observedTimestamp!: number; - @PrimaryColumn({ name: 'name' }) - public name!: string; + @PrimaryColumn({ name: 'full_name' }) + public fullName!: string; @Column({ name: 'created_at', type: 'bigint', transformer: numberToBigIntTransformer }) public createdAt!: number; diff --git a/packages/pipeline/src/parsers/github/forks.ts b/packages/pipeline/src/parsers/github/forks.ts index 39140aecf1..1467a2b775 100644 --- a/packages/pipeline/src/parsers/github/forks.ts +++ b/packages/pipeline/src/parsers/github/forks.ts @@ -9,7 +9,7 @@ export function parseGithubForks(response: GithubForkResponse[], observedTimesta const result: GithubFork[] = response.map(fork => { const parsedFork = new GithubFork(); parsedFork.observedTimestamp = observedTimestamp; - parsedFork.name = fork.name; + parsedFork.fullName = fork.full_name; parsedFork.ownerLogin = fork.owner.login; parsedFork.createdAt = Date.parse(fork.created_at); parsedFork.updatedAt = Date.parse(fork.updated_at); diff --git a/packages/pipeline/src/parsers/github/pulls.ts b/packages/pipeline/src/parsers/github/pulls.ts index cebf773366..b4542ad209 100644 --- a/packages/pipeline/src/parsers/github/pulls.ts +++ b/packages/pipeline/src/parsers/github/pulls.ts @@ -12,7 +12,7 @@ export function parseGithubPulls( return response.map(pull => { const parsedPullRequest = new GithubPullRequest(); parsedPullRequest.observedTimestamp = observedTimestamp; - parsedPullRequest.repoName = pull.base.repo.name; + parsedPullRequest.repoFullName = pull.base.repo.full_name; parsedPullRequest.createdAt = Date.parse(pull.created_at); parsedPullRequest.updatedAt = Date.parse(pull.updated_at); parsedPullRequest.closedAt = pull.closed_at ? Date.parse(pull.closed_at) : null; diff --git a/packages/pipeline/src/parsers/github/repo.ts b/packages/pipeline/src/parsers/github/repo.ts index e6b4d808be..58f742f9f5 100644 --- a/packages/pipeline/src/parsers/github/repo.ts +++ b/packages/pipeline/src/parsers/github/repo.ts @@ -8,7 +8,7 @@ import { GithubRepo } from '../../entities'; export function parseGithubRepo(rawRepo: GithubRepoResponse, observedTimestamp: number): GithubRepo { const parsedRepo = new GithubRepo(); parsedRepo.observedTimestamp = observedTimestamp; - parsedRepo.name = rawRepo.name; + parsedRepo.fullName = rawRepo.full_name; parsedRepo.createdAt = Date.parse(rawRepo.created_at); parsedRepo.updatedAt = Date.parse(rawRepo.updated_at); parsedRepo.pushedAt = Date.parse(rawRepo.pushed_at); diff --git a/packages/pipeline/src/scripts/pull_github.ts b/packages/pipeline/src/scripts/pull_github.ts index d2534224d9..98a8ef7179 100644 --- a/packages/pipeline/src/scripts/pull_github.ts +++ b/packages/pipeline/src/scripts/pull_github.ts @@ -24,7 +24,7 @@ let connection: Connection; connection = await createConnection(ormConfig as ConnectionOptions); const accessToken = process.env.GITHUB_ACCESS_TOKEN; if (accessToken === undefined) { - throw new Error('Missing required env var: BLOXY_API_KEY'); + throw new Error('Missing required env var: GITHUB_ACCESS_TOKEN'); } const githubSource = new GithubSource(GITHUB_OWNER, GITHUB_REPO, GITHUB_BRANCH, accessToken); const observedTimestamp = Date.now(); diff --git a/packages/pipeline/test/entities/github_test.ts b/packages/pipeline/test/entities/github_test.ts index 2d4d819243..20668f3126 100644 --- a/packages/pipeline/test/entities/github_test.ts +++ b/packages/pipeline/test/entities/github_test.ts @@ -12,7 +12,7 @@ chaiSetup.configure(); // tslint:disable:custom-no-magic-numbers const fork: GithubFork = { observedTimestamp: Date.now(), - name: '0x-monorepo', + fullName: 'NoahZinsmeister/0x-monorepo', ownerLogin: 'NoahZinsmeister', createdAt: 1552181010000, updatedAt: 1552191123000, @@ -33,7 +33,7 @@ const fork: GithubFork = { const pullRequest: GithubPullRequest = { observedTimestamp: Date.now(), - repoName: '0x-monorepo', + repoFullName: '0xProject/0x-monorepo', pullRequestNumber: 1684, state: 'open', title: '[WIP] Pull Github data', @@ -46,7 +46,7 @@ const pullRequest: GithubPullRequest = { const repo: GithubRepo = { observedTimestamp: Date.now(), - name: '0x-monorepo', + fullName: '0xProject/0x-monorepo', createdAt: 1495549053000, updatedAt: 1551908929000, pushedAt: 1551916745000, diff --git a/packages/pipeline/test/fixtures/github/api_v3_forks.ts b/packages/pipeline/test/fixtures/github/api_v3_forks.ts index 8a280e3dab..3af9129c69 100644 --- a/packages/pipeline/test/fixtures/github/api_v3_forks.ts +++ b/packages/pipeline/test/fixtures/github/api_v3_forks.ts @@ -13,7 +13,7 @@ import { GithubFork } from '../../../src/entities'; const ParsedGithubFork = new GithubFork(); ParsedGithubFork.observedTimestamp = Date.now(); -ParsedGithubFork.name = '0x-monorepo'; +ParsedGithubFork.fullName = 'NoahZinsmeister/0x-monorepo'; ParsedGithubFork.ownerLogin = 'NoahZinsmeister'; ParsedGithubFork.createdAt = 1552181010000; // tslint:disable-line:custom-no-magic-numbers ParsedGithubFork.updatedAt = 1552191123000; // tslint:disable-line:custom-no-magic-numbers diff --git a/packages/pipeline/test/fixtures/github/api_v3_pulls.ts b/packages/pipeline/test/fixtures/github/api_v3_pulls.ts index 38328e034e..f8935f9664 100644 --- a/packages/pipeline/test/fixtures/github/api_v3_pulls.ts +++ b/packages/pipeline/test/fixtures/github/api_v3_pulls.ts @@ -6,7 +6,7 @@ import { GithubPullRequest } from '../../../src/entities'; const ParsedGithubPullRequest: GithubPullRequest = { observedTimestamp: Date.now(), - repoName: '0x-monorepo', + repoFullName: '0xProject/0x-monorepo', pullRequestNumber: 1684, state: 'open', title: '[WIP] Pull Github data', diff --git a/packages/pipeline/test/fixtures/github/api_v3_repo.ts b/packages/pipeline/test/fixtures/github/api_v3_repo.ts index 1ab909597e..0c17098801 100644 --- a/packages/pipeline/test/fixtures/github/api_v3_repo.ts +++ b/packages/pipeline/test/fixtures/github/api_v3_repo.ts @@ -6,7 +6,7 @@ import { GithubRepo } from '../../../src/entities'; const ParsedGithubRepo: GithubRepo = { observedTimestamp: Date.now(), - name: '0x-monorepo', + fullName: '0xProject/0x-monorepo', createdAt: 1495549053000, updatedAt: 1551908929000, pushedAt: 1551916745000,