danger / peril

☢️ Serious and immediate danger.
https://danger.systems
MIT License
460 stars 58 forks source link

GitHub API is undefined #456

Closed steprescott closed 4 years ago

steprescott commented 5 years ago

I am self hosting Peril on a Google App Engine instance using the latest DockerHub image.

My dangerfile.ts is called according to the events set in my settings.json file however danger.github.api is undefined when that file is ran by danger.

It's my understanding, from reading the comments, that danger.github.api should return ready to use instance of octokit/rest.

interface GitHubDSL extends GitHubJSONDSL {
  /**
   * An authenticated API so you can extend danger's behavior by using the [GitHub v3 API](https://developer.github.com/v3/).
   *
   * A set up instance of the "github" npm module. You can get the full [API here](https://octokit.github.io/node-github/).
   */
  api: GitHub
}

Danger can successfully post comments on my private repo so I feel that I have set Danger up correctly. I have attempted both with the utils function as well as via the api directly.

Utils example

schedule(async () => {
    const data = await danger.github.utils.fileContents("README.md", <ORG/REPO>)
    message(data);
})

Result

Cannot read property 'fileContents' of undefined
TypeError: Cannot read property 'fileContents' of undefined
    at schedule (/app/danger-0.y69ab3fnb3.ts:4:44)
    at /app/node_modules/danger/distribution/runner/runners/inline.js:84:32
    at Array.map (<anonymous>)
    at Object.<anonymous> (/app/node_modules/danger/distribution/runner/runners/inline.js:76:68)
    at step (/app/node_modules/danger/distribution/runner/runners/inline.js:32:23)
    at Object.next (/app/node_modules/danger/distribution/runner/runners/inline.js:13:53)
    at /app/node_modules/danger/distribution/runner/runners/inline.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/app/node_modules/danger/distribution/runner/runners/inline.js:3:12)
    at runAllScheduledTasks (/app/node_modules/danger/distribution/runner/runners/inline.js:70:56)
    at Object.<anonymous> (/app/node_modules/danger/distribution/runner/runners/inline.js:156:38)
    at step (/app/node_modules/danger/distribution/runner/runners/inline.js:32:23)
    at Object.next (/app/node_modules/danger/distribution/runner/runners/inline.js:13:53)
    at /app/node_modules/danger/distribution/runner/runners/inline.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/app/node_modules/danger/distribution/runner/runners/inline.js:3:12)

API example

const options: ReposGetContentsParams = { owner: <OWNER>, repo:<REPO>, path: "README.md" };

schedule(async () => {
    await danger.github.api.repos.getContents(options).then(({ data }) => {
        message(JSON.stringify(data));
    })
})

Result

Cannot read property 'repos' of undefined
TypeError: Cannot read property 'repos' of undefined
    at schedule (/app/danger-0.4m1l6w4754w.ts:9:29)
    at /app/node_modules/danger/distribution/runner/runners/inline.js:84:32
    at Array.map (<anonymous>)
    at Object.<anonymous> (/app/node_modules/danger/distribution/runner/runners/inline.js:76:68)
    at step (/app/node_modules/danger/distribution/runner/runners/inline.js:32:23)
    at Object.next (/app/node_modules/danger/distribution/runner/runners/inline.js:13:53)
    at /app/node_modules/danger/distribution/runner/runners/inline.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/app/node_modules/danger/distribution/runner/runners/inline.js:3:12)
    at runAllScheduledTasks (/app/node_modules/danger/distribution/runner/runners/inline.js:70:56)
    at Object.<anonymous> (/app/node_modules/danger/distribution/runner/runners/inline.js:156:38)
    at step (/app/node_modules/danger/distribution/runner/runners/inline.js:32:23)
    at Object.next (/app/node_modules/danger/distribution/runner/runners/inline.js:13:53)
    at /app/node_modules/danger/distribution/runner/runners/inline.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/app/node_modules/danger/distribution/runner/runners/inline.js:3:12)
App Engine logs

_Latest log first_ ``` info: - Local: http://localhost:8080 "info: ✓ Server:" "info: ✓ JSON Db at /@settings.json" "info: ⅹ Clustering" "info: ⅹ Papertrail" "info: ☢️ Starting up Peril" Sun, 25 Aug 2019 18:59:31 GMT express:router:layer new '/' Sun, 25 Aug 2019 18:59:31 GMT express:router:route post '/webhook' Sun, 25 Aug 2019 18:59:31 GMT express:router:layer new '/webhook' Sun, 25 Aug 2019 18:59:31 GMT express:router:route new '/webhook' Sun, 25 Aug 2019 18:59:31 GMT express:router:layer new '/' Sun, 25 Aug 2019 18:59:31 GMT express:router use '/' serveStatic Sun, 25 Aug 2019 18:59:31 GMT express:router:layer new '/' Sun, 25 Aug 2019 18:59:31 GMT express:router use '/' jsonParser Sun, 25 Aug 2019 18:59:31 GMT express:router:layer new '/' Sun, 25 Aug 2019 18:59:31 GMT express:router use '/' Sun, 25 Aug 2019 18:59:31 GMT express:router:layer new '/' Sun, 25 Aug 2019 18:59:31 GMT express:router use '/' expressInit Sun, 25 Aug 2019 18:59:31 GMT express:router:layer new '/' Sun, 25 Aug 2019 18:59:31 GMT express:router use '/' query Sun, 25 Aug 2019 18:59:31 GMT express:application set "port" to '8080' Sun, 25 Aug 2019 18:59:31 GMT express:application set "jsonp callback name" to 'callback' Sun, 25 Aug 2019 18:59:31 GMT express:application set "views" to '/app/views' Sun, 25 Aug 2019 18:59:31 GMT express:application set "view" to [Function: View] Sun, 25 Aug 2019 18:59:31 GMT express:application booting in development mode Sun, 25 Aug 2019 18:59:31 GMT express:application set "trust proxy fn" to [Function: trustNone] Sun, 25 Aug 2019 18:59:31 GMT express:application set "trust proxy" to false Sun, 25 Aug 2019 18:59:31 GMT express:application set "subdomain offset" to 2 Sun, 25 Aug 2019 18:59:31 GMT express:application set "query parser fn" to [Function: parseExtendedQueryString] Sun, 25 Aug 2019 18:59:31 GMT express:application set "query parser" to 'extended' Sun, 25 Aug 2019 18:59:31 GMT express:application set "env" to 'development' Sun, 25 Aug 2019 18:59:31 GMT express:application set "etag fn" to [Function: generateETag] Sun, 25 Aug 2019 18:59:31 GMT express:application set "etag" to 'weak' Sun, 25 Aug 2019 18:59:31 GMT express:application set "x-powered-by" to true "TypeError: Cannot read property 'length' of undefined at Executor. (/app/node_modules/danger/distribution/runner/Executor.js:305:60) at step (/app/node_modules/danger/distribution/runner/Executor.js:32:23) at Object.next (/app/node_modules/danger/distribution/runner/Executor.js:13:53) at fulfilled (/app/node_modules/danger/distribution/runner/Executor.js:4:58) at process._tickCallback (internal/process/next_tick.js:68:7)" " " " ^ " " throw reason; " /app/out/peril.js:25 "error: UnhandledRejection Error: message=Cannot read property 'length' of undefined, stack=TypeError: Cannot read property 'length' of undefined at Executor. (/app/node_modules/danger/distribution/runner/Executor.js:305:60) at step (/app/node_modules/danger/distribution/runner/Executor.js:32:23) at Object.next (/app/node_modules/danger/distribution/runner/Executor.js:13:53) at fulfilled (/app/node_modules/danger/distribution/runner/Executor.js:4:58) at process._tickCallback (internal/process/next_tick.js:68:7)" 2019-08-25T18:59:30.303Z danger:GitHubAPI getNextPageFromLinkHeader:: Given response does not contain link header for pagination " Accept: 'application/vnd.github.machine-man-preview+json' } " Authorization: 'token v1.4a9efe505cd0c0a8b4435879da5ac46a12c04c66', 2019-08-25T18:59:30.102Z danger:GitHubAPI Sending: https://api.github.com/repos///pulls/1/comments { 'Content-Type': 'application/json', 2019-08-25T18:59:30.102Z danger:GitHubAPI getPullRequestCommits:: Request url generated "repos///pulls/1/comments" 2019-08-25T18:59:30.100Z danger:GitHubAPI getPullRequestCommits:: Sending pull request commit request for first page "Found only messages, passing those to review. " 'Danger run resulted in 1 fail and 1 markdown; to find out more, see the [checks page](https://github.com///runs/202742239).' } ] } " [ { message: " " markdowns: " " fails: [], " " messages: [], " 2019-08-25T18:59:30.099Z danger:executor Posting to platform: { warnings: [], 'Danger run resulted in 1 fail and 1 markdown; to find out more, see the [checks page](https://github.com///runs/202742239).' } ] } " [ { message: " " markdowns: " " fails: [], " " messages: [], " 2019-08-25T18:59:30.096Z danger:executor Received results from platformResultsPreMapper: { warnings: [], 2019-08-25T18:59:30.095Z danger:GitHub::Checks {"id":202742239,"node_id":"MDg6Q2hlY2tSdW4yMDI3NDIyMzk=","head_sha":"74992f5da050b9414f10b0486cf6561fe44b5500","external_id":"","url":"https://api.github.com/repos///check-runs/202742239","html_url":"https://github.com///runs/202742239","details_url":"","status":"completed","conclusion":"failure","started_at":"2019-08-25T18:59:29Z","completed_at":"2019-08-25T18:59:29Z","output":{"title":"","summary":"\n\n\n

\n \n \n \n \n \n \n \n \n \n \n \n
Fails
:no_entry_sign:\n\n Danger failed to run `/app/danger-0.i9qep1zgtvd.ts`.\n
\n\n\n\n## Error TypeError\n```\nCannot read property 'repos' of undefined\nTypeError: Cannot read property 'repos' of undefined\n at schedule (/app/danger-0.i9qep1zgtvd.ts:9:29)\n at /app/node_modules/danger/distribution/runner/runners/inline.js:84:32\n at Array.map ()\n at Object. (/app/node_modules/danger/distribution/runner/runners/inline.js:76:68)\n at step (/app/node_modules/danger/distribution/runner/runners/inline.js:32:23)\n at Object.next (/app/node_modules/danger/distribution/runner/runners/inline.js:13:53)\n at /app/node_modules/danger/distribution/runner/runners/inline.js:7:71\n at new Promise ()\n at __awaiter (/app/node_modules/danger/distribution/runner/runners/inline.js:3:12)\n at runAllScheduledTasks (/app/node_modules/danger/distribution/runner/runners/inline.js:70:56)\n at Object. (/app/node_modules/danger/distribution/runner/runners/inline.js:156:38)\n at step (/app/node_modules/danger/distribution/runner/runners/inline.js:32:23)\n at Object.next (/app/node_modules/danger/distribution/runner/runners/inline.js:13:53)\n at /app/node_modules/danger/distribution/runner/runners/inline.js:7:71\n at new Promise ()\n at __awaiter (/app/node_modules/danger/distribution/runner/runners/inline.js:3:12)\n```\n### Dangerfile\n```\n 4| // schedule(async () => {\n 5| // const data = await danger.github.utils.fileContents(\"README.md\", \"/\")\n 6| // message(data);\n 7| // })\n 8| \n-------------------------------^\n 9| let options: ReposGetContentsParams = { owner: \"/\", repo:\"\", path: \"README.md\" };\n10| \n11| schedule(async () => {\n12| await danger.github.api.repos.getContents(options).then(({ data }) => {\n```\n \n

\n Generated by :no_entry_sign: dangerJS against 74992f5da050b9414f10b0486cf6561fe44b5500\n

\n","text":null,"annotations_count":0,"annotations_url":"https://api.github.com/repos///check-runs/202742239/annotations"},"name":"Danger","check_suite":{"id":201103019},"app":{"id":26462,"node_id":"MDM6QXBwMjY0NjI=","owner":{"login":"","id":1391938,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzOTE5Mzg=","avatar_url":"https://avatars1.githubusercontent.com/u/1391938?v=4","gravatar_id":"","url":"https://api.github.com/users/","html_url":"https://github.com/","followers_url":"https://api.github.com/users//followers","following_url":"https://api.github.com/users//following{/other_user}","gists_url":"https://api.github.com/users//gists{/gist_id}","starred_url":"https://api.github.com/users//starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users//subscriptions","organizations_url":"https://api.github.com/users//orgs","repos_url":"https://api.github.com/users//repos","events_url":"https://api.github.com/users//events{/privacy}","received_events_url":"https://api.github.com/users//received_events","type":"Organization","site_admin":false},"name":"Peril","description":"","external_url":"","html_url":"https://github.com/apps/peril","created_at":"2019-03-05T17:27:45Z","updated_at":"2019-07-24T15:49:59Z","permissions":{"checks":"write","contents":"read","issues":"write","metadata":"read","pull_requests":"write","statuses":"write"},"events":["issues","issue_comment","pull_request","pull_request_review","pull_request_review_comment"]},"pull_requests":[{"url":"https://api.github.com/repos///pulls/1","id":310634740,"number":1,"head":{"ref":"peril-test","sha":"74992f5da050b9414f10b0486cf6561fe44b5500","repo":{"id":204197238,"url":"https://api.github.com/repos//","name":""}},"base":{"ref":"master","sha":"25dc0fb48384056127c3158b9246d71669ad2fec","repo":{"id":204197238,"url":"https://api.github.com/repos//","name":""}}}]} 2019-08-25T18:59:30.093Z danger:GitHub::Checks Got response on the checks API Authorization: 'token v1.4a9efe505cd0c0a8b4435879da5ac46a12c04c66' } " 'application/vnd.github.antiope-preview+json,application/vnd.github.machine-man-preview+json', " " Accept: " 2019-08-25T18:59:29.622Z danger:GitHubAPI Sending: https://api.github.com/repos///check-runs { 'Content-Type': 'application/json', 2019-08-25T18:59:29.620Z danger:GitHub::ResultsToCheck Generating inline annotations "Error: new Octokit({headers}) is deprecated. Use {userAgent, previews} instead. See https://github.com/octokit/rest.js#client-options at parseOptions (/app/node_modules/@octokit/rest/lib/parse-client-options.js:43:14) at new Octokit (/app/node_modules/@octokit/rest/lib/constructor.js:21:50) at GitHubAPI.getExternalAPI (/app/node_modules/danger/distribution/platforms/github/GitHubAPI.js:85:20) at Object. (/app/node_modules/danger/distribution/platforms/github/comms/checksCommenter.js:115:104) at step (/app/node_modules/danger/distribution/platforms/github/comms/checksCommenter.js:32:23) at Object.next (/app/node_modules/danger/distribution/platforms/github/comms/checksCommenter.js:13:53) at fulfilled (/app/node_modules/danger/distribution/platforms/github/comms/checksCommenter.js:4:58) at process._tickCallback (internal/process/next_tick.js:68:7)" " Accept: 'application/vnd.github.machine-man-preview+json' } " Authorization: 'token v1.4a9efe505cd0c0a8b4435879da5ac46a12c04c66', 2019-08-25T18:59:29.199Z danger:GitHubAPI Sending: https://api.github.com/repos///pulls/1 { 'Content-Type': 'application/json', 2019-08-25T18:59:29.198Z danger:GitHub::Checks Getting PR details for checks 2019-08-25T18:59:29.196Z danger:executor Running platformResultsPreMapper: " passURLForDSL: false } " " disableGitHubChecksSupport: undefined, " " verbose: false, " " stdoutOnly: false, " " jsonOnly: false, " 2019-08-25T18:59:29.195Z danger:executor Evaluator settings { dangerID: 'peril', " warnings: [] } " " messages: [], " " line: undefined } ], " " file: undefined, " '## Error TypeError\n```\nCannot read property \'repos\' of undefined\nTypeError: Cannot read property \'repos\' of undefined\n at schedule (/app/danger-0.i9qep1zgtvd.ts:9:29)\n at /app/node_modules/danger/distribution/runner/runners/inline.js:84:32\n at Array.map ()\n at Object. (/app/node_modules/danger/distribution/runner/runners/inline.js:76:68)\n at step (/app/node_modules/danger/distribution/runner/runners/inline.js:32:23)\n at Object.next (/app/node_modules/danger/distribution/runner/runners/inline.js:13:53)\n at /app/node_modules/danger/distribution/runner/runners/inline.js:7:71\n at new Promise ()\n at __awaiter (/app/node_modules/danger/distribution/runner/runners/inline.js:3:12)\n at runAllScheduledTasks (/app/node_modules/danger/distribution/runner/runners/inline.js:70:56)\n at Object. (/app/node_modules/danger/distribution/runner/runners/inline.js:156:38)\n at step (/app/node_modules/danger/distribution/runner/runners/inline.js:32:23)\n at Object.next (/app/node_modules/danger/distribution/runner/runners/inline.js:13:53)\n at /app/node_modules/danger/distribution/runner/runners/inline.js:7:71\n at new Promise ()\n at __awaiter (/app/node_modules/danger/distribution/runner/runners/inline.js:3:12)\n```\n### Dangerfile\n```\n 4| // schedule(async () => {\n 5| // const data = await danger.github.utils.fileContents("README.md", "/")\n 6| // message(data);\n 7| // })\n 8| \n-------------------------------^\n 9| let options: ReposGetContentsParams = { owner: "", repo:"", path: "README.md" };\n10| \n11| schedule(async () => {\n12| await danger.github.api.repos.getContents(options).then(({ data }) => {\n```\n ', " [ { message: " " markdowns: " " line: undefined } ], " " file: undefined, " [ { message: 'Danger failed to run `/app/danger-0.i9qep1zgtvd.ts`.', 2019-08-25T18:59:29.191Z danger:executor Got results back: { fails: " " fails: 1 warns: 0 messages: 0 mds: 1 "info: [runner] - Commenting, with results: " "2019-08-25T18:59:29.179Z danger:inline_runner Got a parse error: TypeError: Cannot read property 'repos' of undefined at schedule (/app/danger-0.i9qep1zgtvd.ts:9:29) at /app/node_modules/danger/distribution/runner/runners/inline.js:84:32 at Array.map () at Object. (/app/node_modules/danger/distribution/runner/runners/inline.js:76:68) at step (/app/node_modules/danger/distribution/runner/runners/inline.js:32:23) at Object.next (/app/node_modules/danger/distribution/runner/runners/inline.js:13:53) at /app/node_modules/danger/distribution/runner/runners/inline.js:7:71 at new Promise () at __awaiter (/app/node_modules/danger/distribution/runner/runners/inline.js:3:12) at runAllScheduledTasks (/app/node_modules/danger/distribution/runner/runners/inline.js:70:56) at Object. (/app/node_modules/danger/distribution/runner/runners/inline.js:156:38) at step (/app/node_modules/danger/distribution/runner/runners/inline.js:32:23) at Object.next (/app/node_modules/danger/distribution/runner/runners/inline.js:13:53) at /app/node_modules/danger/distribution/runner/runners/inline.js:7:71 at new Promise () at __awaiter (/app/node_modules/danger/distribution/runner/runners/inline.js:3:12)" "TypeError: Cannot read property 'repos' of undefined at schedule (/app/danger-0.i9qep1zgtvd.ts:9:29) at /app/node_modules/danger/distribution/runner/runners/inline.js:84:32 at Array.map () at Object. (/app/node_modules/danger/distribution/runner/runners/inline.js:76:68) at step (/app/node_modules/danger/distribution/runner/runners/inline.js:32:23) at Object.next (/app/node_modules/danger/distribution/runner/runners/inline.js:13:53) at /app/node_modules/danger/distribution/runner/runners/inline.js:7:71 at new Promise () at __awaiter (/app/node_modules/danger/distribution/runner/runners/inline.js:3:12) at runAllScheduledTasks (/app/node_modules/danger/distribution/runner/runners/inline.js:70:56) at Object. (/app/node_modules/danger/distribution/runner/runners/inline.js:156:38) at step (/app/node_modules/danger/distribution/runner/runners/inline.js:32:23) at Object.next (/app/node_modules/danger/distribution/runner/runners/inline.js:13:53) at /app/node_modules/danger/distribution/runner/runners/inline.js:7:71 at new Promise () at __awaiter (/app/node_modules/danger/distribution/runner/runners/inline.js:3:12)" "Unable to evaluate the Dangerfile " 2019-08-25T18:59:29.172Z danger:inline_runner Scheduler waiting on: 1 tasks 2019-08-25T18:59:29.171Z danger:inline_runner Finished running dangerfile: /app/danger-0.i9qep1zgtvd.ts 2019-08-25T18:59:29.169Z danger:inline_runner Started parsing Dangerfile: /app/danger-0.i9qep1zgtvd.ts 2019-08-25T18:59:28.669Z danger:transpiler:setup Does not have Flow set up 2019-08-25T18:59:28.668Z danger:transpiler:setup Does not have Babel 7 TypeScript set up "@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning. " 2019-08-25T18:59:28.564Z danger:transpiler:setup Does not have Flow set up 2019-08-25T18:59:28.563Z danger:transpiler:setup Does not have Babel 7 TypeScript set up Authorization: 'token v1.4a9efe505cd0c0a8b4435879da5ac46a12c04c66' } 'application/vnd.github.machine-man-preview+json, application/vnd.github.v3+json', " Accept: " 2019-08-25T18:59:28.367Z danger:GitHubAPI Sending: https://api.github.com/repos///pulls/1/requested_reviewers { 'Content-Type': 'application/json', Authorization: 'token v1.4a9efe505cd0c0a8b4435879da5ac46a12c04c66' } 'application/vnd.github.machine-man-preview+json, application/vnd.github.v3+json', " Accept: " 2019-08-25T18:59:28.118Z danger:GitHubAPI Sending: https://api.github.com/repos///pulls/1/reviews { 'Content-Type': 'application/json', 2019-08-25T18:59:28.117Z danger:GitHubAPI getNextPageFromLinkHeader:: Given response does not contain link header for pagination " Accept: 'application/vnd.github.machine-man-preview+json' } " Authorization: 'token v1.4a9efe505cd0c0a8b4435879da5ac46a12c04c66', 2019-08-25T18:59:27.870Z danger:GitHubAPI Sending: https://api.github.com/repos///pulls/1/commits { 'Content-Type': 'application/json', 2019-08-25T18:59:27.869Z danger:GitHubAPI getPullRequestCommits:: Request url generated "repos///pulls/1/commits" 2019-08-25T18:59:27.867Z danger:GitHubAPI getPullRequestCommits:: Sending pull request commit request for first page " Accept: 'application/vnd.github.machine-man-preview+json' } " Authorization: 'token v1.4a9efe505cd0c0a8b4435879da5ac46a12c04c66', 2019-08-25T18:59:27.660Z danger:GitHubAPI Sending: https://api.github.com/repos///issues/1 { 'Content-Type': 'application/json', " Accept: 'application/vnd.github.machine-man-preview+json' } " Authorization: 'token v1.4a9efe505cd0c0a8b4435879da5ac46a12c04c66', 2019-08-25T18:59:27.304Z danger:GitHubAPI Sending: https://api.github.com/repos///pulls/1 { 'Content-Type': 'application/json', 2019-08-25T18:59:27.300Z danger:GitHubAPI getNextPageFromLinkHeader:: Given response does not contain link header for pagination " Accept: 'application/vnd.github.machine-man-preview+json' } " Authorization: 'token v1.4a9efe505cd0c0a8b4435879da5ac46a12c04c66', 2019-08-25T18:59:26.999Z danger:GitHubAPI Sending: https://api.github.com/repos///pulls/1/commits { 'Content-Type': 'application/json', 2019-08-25T18:59:26.998Z danger:GitHubAPI getPullRequestCommits:: Request url generated "repos///pulls/1/commits" 2019-08-25T18:59:26.996Z danger:GitHubAPI getPullRequestCommits:: Sending pull request commit request for first page Authorization: 'token v1.4a9efe505cd0c0a8b4435879da5ac46a12c04c66' } 'application/vnd.github.machine-man-preview+json, application/vnd.github.v3.diff', " Accept: " 2019-08-25T18:59:26.763Z danger:GitHubAPI Sending: https://api.github.com/repos///pulls/1 { 'Content-Type': 'application/json', info: 1 run needed: /@dangerfile.ts "info: ## pull_request.edited on unknown on / " "info: " Sun, 25 Aug 2019 18:59:25 GMT express:router serveStatic : /webhook Sun, 25 Aug 2019 18:59:25 GMT body-parser:json body already parsed Sun, 25 Aug 2019 18:59:25 GMT express:router jsonParser : /webhook Sun, 25 Aug 2019 18:59:25 GMT express:router : /webhook Sun, 25 Aug 2019 18:59:25 GMT express:router expressInit : /webhook Sun, 25 Aug 2019 18:59:25 GMT express:router query : /webhook Sun, 25 Aug 2019 18:59:25 GMT express:router dispatching POST /webhook ```

Any advice on how to interact with danger.github.api or if there are setup steps that I am missing would be a great help.

Similar issue

https://github.com/danger/danger-js/issues/780

steprescott commented 5 years ago

Just looked through the latest issues that didn't show up during my search of GitHub API and found another related issue. https://github.com/danger/peril/issues/431

olivertso commented 5 years ago

@steprescott The latest docker image is outdated: last update was 7 months ago. But a fix was merged recently. It should work if you build from source code.

orta commented 5 years ago

I think there were docker hub token leaks so it got disconnected and I'm not sure if they've been updated for the mono-repo either (because I have never used them)

steprescott commented 5 years ago

@orta is there possibility of adding DockerHub back into your release pipeline? I can make my own dockerfile but it might be useful for others to adopt Danger on different PAS.

orta commented 5 years ago

It's hooked back up, but it's failing - I'll leave getting that working to someone who uses it: https://cloud.docker.com/repository/registry-1.docker.io/dangersystems/peril/builds/9629ec84-80b9-426a-9882-53ab923282ea

steprescott commented 5 years ago

I can build the image locally. From the link above I can't see any logs as to why it failed. Happy to fix it but with docker build . working I can only assume it's something with the link up with DockerHub that I don't have access to.

docker build .
Sending build context to Docker daemon  376.1MB
Step 1/7 : FROM node:10-slim
10-slim: Pulling from library/node
9fc222b64b0a: Pull complete
7d73b1e8f94b: Pull complete
1e85568843aa: Pull complete
e63716e03d73: Pull complete
0de88bdd8a01: Pull complete
Digest: sha256:d5dc8e967cf60394ed8361f20ec370b66bc7260d70bbe0ea3137dbfb573fcea9
Status: Downloaded newer image for node:10-slim
 ---> 9bfd5b64f034
Step 2/7 : ADD . /app
 ---> 84ac9cf33dc0
Step 3/7 : WORKDIR /app/api
 ---> Running in 0896551597a2
Removing intermediate container 0896551597a2
 ---> 0d26cc6d9a82
Step 4/7 : RUN yarn install
 ---> Running in 2a6bcb5831f4
yarn install v1.17.3
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info fsevents@1.2.4: The platform "linux" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning "danger-plugin-spellcheck > markdown-spellcheck > sinon-as-promised@4.0.3" has unmet peer dependency "sinon@1".
warning " > graphql-relay-tools@0.1.1" has incorrect peer dependency "graphql@^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0-b || ^0.9.0 || ^0.10.0 || ^0.11.0".
warning " > graphql-schema-utils@0.6.5" has incorrect peer dependency "graphql@^0.8.2".
warning "jest > jest-cli > @jest/core > jest-resolve-dependencies@24.5.0" has unmet peer dependency "jest-resolve@^24.1.0".
warning "jest > jest-cli > jest-config > jest-resolve@24.5.0" has unmet peer dependency "jest-haste-map@^24.0.0".
[5/5] Building fresh packages...
$ yarn build; if [ $DATABASE_JSON_FILE ]; then yarn run setup; fi
yarn run v1.17.3
$ tsc
Done in 13.11s.
Done in 57.28s.
Removing intermediate container 2a6bcb5831f4
 ---> 424b6be37cad
Step 5/7 : ENV PORT=80
 ---> Running in c57426abac46
Removing intermediate container c57426abac46
 ---> d243fb9a919a
Step 6/7 : EXPOSE 80
 ---> Running in 8442975d1b31
Removing intermediate container 8442975d1b31
 ---> 273bf8285629
Step 7/7 : CMD yarn start
 ---> Running in c9ad18d385e5
Removing intermediate container c9ad18d385e5
 ---> 14bc6887d466
Successfully built 14bc6887d466
steprescott commented 4 years ago

Docker autobuilds are now working after https://github.com/danger/peril/pull/463

https://hub.docker.com/r/dangersystems/peril/builds

steprescott commented 4 years ago

Now the image has been updated I can use the GitHub API. Thanks.