Skip to content

Commit

Permalink
Merge pull request #460 from danger/token_note
Browse files Browse the repository at this point in the history
Add a note about setting up a token in danger pr
  • Loading branch information
orta committed Dec 29, 2017
2 parents a872fb7 + 28b3f28 commit 7995114
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ docs
.editorconfig
.babelrc
scripts
dangerfile.js
dangerfile.ts
env
jsconfig.json
coverage
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<!--
// Please add your own contribution below inside the Master section
// These docs are aimed at users rather than danger developers, so please limit technical
// terminology to in here.
// ### Master
-->

## Master

* Add a note in `danger pr` if you don't have a token set up - [@orta][]

### 2.1.7

Expand Down
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": "2.1.7",
"version": "2.1.8",
"description": "Unit tests for Team Culture",
"main": "distribution/danger.js",
"typings": "distribution/danger.d.ts",
Expand Down
8 changes: 7 additions & 1 deletion source/commands/danger-pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,16 @@ if (program.args.length === 0) {
// TODO: Use custom `fetch` in GitHub that stores and uses local cache if PR is closed, these PRs
// shouldn't change often and there is a limit on API calls per hour.

const token = process.env["DANGER_GITHUB_API_TOKEN"]
if (!token) {
console.log("You don't have a DANGER_GITHUB_API_TOKEN set up, this is optional, but TBH, you want to do this")
console.log("Check out: http://danger.systems/js/guides/the_dangerfile.html#working-on-your-dangerfile")
}

if (validateDangerfileExists(dangerFile)) {
d(`executing dangerfile at ${dangerFile}`)
const source = new FakeCI({ DANGER_TEST_REPO: pr.repo, DANGER_TEST_PR: pr.pullRequestNumber })
const api = new GitHubAPI(source, process.env["DANGER_GITHUB_API_TOKEN"])
const api = new GitHubAPI(source, token)
const platform = new GitHub(api)
if (app.json || app.js) {
runHalfProcessJSON(platform)
Expand Down
2 changes: 1 addition & 1 deletion source/runner/Executor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { contextForDanger, DangerContext } from "../runner/Dangerfile"
import { contextForDanger, DangerContext } from "./Dangerfile"
import { DangerDSL } from "../dsl/DangerDSL"
import { CISource } from "../ci_source/ci_source"
import { Platform } from "../platforms/platform"
Expand Down

0 comments on commit 7995114

Please sign in to comment.