Skip to content

Commit

Permalink
Merged by Peril
Browse files Browse the repository at this point in the history
Improve peril checks
  • Loading branch information
peril-staging[bot] authored May 19, 2018
2 parents 65c129c + 877463f commit 257c3d8
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 196 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ matrix:
- node_js: '7'
script:
- echo "This is only for Integration tests on two blank projects"
getReviewInfo = (): Promise<GitHubPRDSL> => this.api.getPullRequestInfo() - yarn build
- yarn build
- mkdir danger_blank_test
- cd danger_blank_test
- yarn init --yes
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@

## Master

# 3.7.1

* Improve checks support for Danger - orta

# 3.7.0

* Adds support for the GH Checks API.
Expand Down
17 changes: 0 additions & 17 deletions jsconfig.json

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion source/platforms/github/comms/checks/resultsToCheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
Expand Down
166 changes: 0 additions & 166 deletions source/platforms/github/comms/checks/types.ts

This file was deleted.

11 changes: 2 additions & 9 deletions source/platforms/github/comms/checksCommenter.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
// import * as debug from "debug"
import { PlatformCommunicator } from "../../platform"
import { GitHubAPI } from "../GitHubAPI"
import { DangerResults } from "../../../dsl/DangerResults"
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 =
Expand All @@ -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?
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion source/runner/jsonToDSL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down

0 comments on commit 257c3d8

Please sign in to comment.