Skip to content

Commit

Permalink
Add some logs to GitHubAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
mokagio committed May 17, 2020
1 parent ec63cac commit aec77d4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source/platforms/github/GitHubAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ export class GitHubAPI {
}
const repo = this.repoMetadata.repoSlug
const prID = this.repoMetadata.pullRequestID
console.log("~~~ into getPullRequestInfo")

This comment has been minimized.

Copy link
@f-meloni

f-meloni May 17, 2020

Member

I don't think we should be pushing changes like this directly to master, and should always come from a PR.
Why those logs? Why are not using d? Is this useful for everyone, also not on debug mode?
If I use Danger not in debug

~~~ into getPullRequestCommits

Is not something I need to know

This comment has been minimized.

Copy link
@mokagio

mokagio May 19, 2020

Author Contributor

This has been solved by #1041.

For context. I'm seeing issues running Danger directly form within a GitHub Action workflow. For example this WordPress-iOS PR and this one on an example repo.

I haven't opened an issue yet because I'm still researching this.

I added those logs to what I thought was my fork of the repo. The reason I added them was to try and get more information when running on GitHub with DEBUG="*". My theory is that some value in the GitHub Action context has changed and now Danger selects a URL which results in a 404 to fetch all the PR information.

Sorry for the confusion this created. Thanks @f-meloni for picking it up. It would indeed been very annoying to have this released.

const res = await this.get(`repos/${repo}/pulls/${prID}`)
const prDSL = (await res.json()) as GitHubPRDSL
this.pr = prDSL
Expand All @@ -214,6 +215,7 @@ export class GitHubAPI {
getPullRequestCommits = async (): Promise<any[]> => {
const repo = this.repoMetadata.repoSlug
const prID = this.repoMetadata.pullRequestID
console.log("~~~ into getPullRequestCommits")
return await this.getAllOfResource(`repos/${repo}/pulls/${prID}/commits`)
}

Expand Down Expand Up @@ -314,6 +316,7 @@ export class GitHubAPI {

getPullRequests = async (): Promise<any> => {
const repo = this.repoMetadata.repoSlug
console.log('~~~ into getPullRequests')
const res = await this.get(`repos/${repo}/pulls`)

return res.ok ? res.json() : []
Expand Down

0 comments on commit aec77d4

Please sign in to comment.