From 3c0970c4722aa3c794e4d4633bbc384725a965cf Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Wed, 16 May 2018 18:37:13 -0400 Subject: [PATCH 1/4] Prepare for release --- .travis.yml | 2 +- CHANGELOG.md | 2 + jsconfig.json | 17 -- package.json | 2 +- source/platforms/github/comms/checks/types.ts | 166 ------------------ .../platforms/github/comms/checksCommenter.ts | 11 +- 6 files changed, 6 insertions(+), 194 deletions(-) delete mode 100644 jsconfig.json delete mode 100644 source/platforms/github/comms/checks/types.ts diff --git a/.travis.yml b/.travis.yml index d1c52bfa3..cddfc0c53 100644 --- a/.travis.yml +++ b/.travis.yml @@ -60,7 +60,7 @@ matrix: - node_js: '7' script: - echo "This is only for Integration tests on two blank projects" -getReviewInfo = (): Promise => this.api.getPullRequestInfo() - yarn build + - yarn build - mkdir danger_blank_test - cd danger_blank_test - yarn init --yes diff --git a/CHANGELOG.md b/CHANGELOG.md index 34c34ec96..b304ddf33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ ## Master +# 3.7.0 + * Adds support for the GH Checks API. This brings some interesting architectural changes inside Danger, but more important to you dear reader, is that using diff --git a/jsconfig.json b/jsconfig.json deleted file mode 100644 index 4cf591ae2..000000000 --- a/jsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=759670 - // for the documentation about the jsconfig.json format - "compilerOptions": { - "target": "es2015", - "module": "commonjs", - "allowSyntheticDefaultImports": true - }, - "exclude": [ - "node_modules", - "bower_components", - "jspm_packages", - "tmp", - "temp", - "distribution" - ] -} diff --git a/package.json b/package.json index 6ed9a0708..7844c7811 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "danger", - "version": "3.6.6", + "version": "3.7.0", "description": "Unit tests for Team Culture", "main": "distribution/danger.js", "typings": "distribution/danger.d.ts", diff --git a/source/platforms/github/comms/checks/types.ts b/source/platforms/github/comms/checks/types.ts deleted file mode 100644 index 5c204e8a1..000000000 --- a/source/platforms/github/comms/checks/types.ts +++ /dev/null @@ -1,166 +0,0 @@ -// TODO, do we want this? - -export interface Output { - title: string - summary: string - text: string -} - -export interface CheckSuite { - id: number -} - -export interface Owner { - login: string - id: number - url: string - repos_url: string - events_url: string - hooks_url: string - issues_url: string - members_url: string - public_members_url: string - avatar_url: string - description: string -} - -export interface App { - id: number - owner: Owner - name: string - description: string - external_url: string - html_url: string - created_at: Date - updated_at: Date -} - -export interface Repo { - id: number - url: string - name: string -} - -export interface Head { - ref: string - sha: string - repo: Repo -} - -export interface Repo2 { - id: number - url: string - name: string -} - -export interface Base { - ref: string - sha: string - repo: Repo2 -} - -export interface PullRequest { - url: string - id: number - head: Head - base: Base -} - -export interface RootObject { - id: number - head_sha: string - external_id: string - url: string - html_url: string - status: string - conclusion?: any - started_at: Date - completed_at?: any - output: Output - name: string - check_suite: CheckSuite - app: App - pull_requests: PullRequest[] -} -export interface Output { - title: string - summary: string - text: string -} - -export interface CheckSuite { - id: number -} - -export interface Owner { - login: string - id: number - url: string - repos_url: string - events_url: string - hooks_url: string - issues_url: string - members_url: string - public_members_url: string - avatar_url: string - description: string -} - -export interface App { - id: number - owner: Owner - name: string - description: string - external_url: string - html_url: string - created_at: Date - updated_at: Date -} - -export interface Repo { - id: number - url: string - name: string -} - -export interface Head { - ref: string - sha: string - repo: Repo -} - -export interface Repo2 { - id: number - url: string - name: string -} - -export interface Base { - ref: string - sha: string - repo: Repo2 -} - -export interface PullRequest { - url: string - id: number - head: Head - base: Base -} - -export interface Check { - id: number - head_sha: string - external_id: string - url: string - html_url: string - status: string - conclusion?: any - started_at: Date - completed_at?: any - output: Output - name: string - check_suite: CheckSuite - app: App - pull_requests: PullRequest[] -} diff --git a/source/platforms/github/comms/checksCommenter.ts b/source/platforms/github/comms/checksCommenter.ts index 797092592..fb52c0df7 100644 --- a/source/platforms/github/comms/checksCommenter.ts +++ b/source/platforms/github/comms/checksCommenter.ts @@ -1,4 +1,3 @@ -// import * as debug from "debug" import { PlatformCommunicator } from "../../platform" import { GitHubAPI } from "../GitHubAPI" import { DangerResults } from "../../../dsl/DangerResults" @@ -6,11 +5,6 @@ import { ExecutorOptions } from "../../../runner/Executor" import { resultsToCheck } from "./checks/resultsToCheck" import { getAccessTokenForInstallation } from "./checks/githubAppSupport" -// See https://github.com/auth0/node-jsonwebtoken/issues/162 -const JWT_REGEX = /^[a-zA-Z0-9\-_]+?\.[a-zA-Z0-9\-_]+?\.([a-zA-Z0-9\-_]+)?$/ - -// const d = debug("danger:GitHub::Checks") - export const getAuthWhenUsingDangerJSApp = () => { const appID = "12316" const key = @@ -37,8 +31,8 @@ export const getCustomAppAuthFromEnv = () => { } const canUseChecks = (token: string | undefined) => { - // Is it a JWT from Peril, basically? - if (token && token.match(JWT_REGEX)) { + // An access token for an app looks like: v1.a06e8953d69edf05f06d61ab016ee80ab4b088ca + if (token && token.startsWith("v1.")) { return true } // Are you using a custom GH app manually? @@ -70,7 +64,6 @@ export const GitHubChecksCommenter = (api: GitHubAPI): PlatformCommunicator | un supportsHandlingResultsManually: () => true, handlePostingResults: async (results: DangerResults, options: ExecutorOptions) => { - console.log("Using Checks") const pr = await api.getPullRequestInfo() let octokit From 8935b2f7ff1d8a676da7147af3ec862d546b0da4 Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Sat, 19 May 2018 13:31:40 -0400 Subject: [PATCH 2/4] Stops using deprecated methods --- source/runner/jsonToDSL.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/runner/jsonToDSL.ts b/source/runner/jsonToDSL.ts index c2f3689fa..7f55b5db4 100644 --- a/source/runner/jsonToDSL.ts +++ b/source/runner/jsonToDSL.ts @@ -49,7 +49,7 @@ const apiForDSL = (dsl: DangerDSLJSONType): GitHubNodeAPI | BitBucketServerAPI = } const api = new GitHubNodeAPI({ - host: dsl.settings.github.baseURL, + baseUrl: dsl.settings.github.baseURL, headers: { ...dsl.settings.github.additionalHeaders, }, From cfa289de0d0b131453431c50991e9f8348a1028a Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Sat, 19 May 2018 13:33:30 -0400 Subject: [PATCH 3/4] Updates the version --- CHANGELOG.md | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b304ddf33..bf88e29bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,10 @@ ## Master +# 3.7.1 + +* Improve checks support for Danger - orta + # 3.7.0 * Adds support for the GH Checks API. diff --git a/package.json b/package.json index 7844c7811..22f974405 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "danger", - "version": "3.7.0", + "version": "3.7.1", "description": "Unit tests for Team Culture", "main": "distribution/danger.js", "typings": "distribution/danger.d.ts", From 877463f9266059b9f7691eaadb8ce5d9d7c460a1 Mon Sep 17 00:00:00 2001 From: Orta Therox Date: Sat, 19 May 2018 14:58:31 -0400 Subject: [PATCH 4/4] Blank the title for now --- source/platforms/github/comms/checks/resultsToCheck.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/platforms/github/comms/checks/resultsToCheck.ts b/source/platforms/github/comms/checks/resultsToCheck.ts index 5338f55c3..3a784ae33 100644 --- a/source/platforms/github/comms/checks/resultsToCheck.ts +++ b/source/platforms/github/comms/checks/resultsToCheck.ts @@ -98,7 +98,7 @@ export const resultsToCheck = async ( // The rest of the vars, need to see this in prod to really make a // nuanced take on what it should look like output: { - title: "Title, figure out what to put here", + title: "", summary: mainBody, annotations: await inlineResultsToAnnotations(annotationResults, options, getBlobUrlForPath), },