Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues using the combined status API #179

Closed
mscharley opened this issue Nov 27, 2017 · 2 comments
Closed

Issues using the combined status API #179

mscharley opened this issue Nov 27, 2017 · 2 comments

Comments

@mscharley
Copy link
Contributor

I'm having some issues with retrieving data from some of our private repos. I'm not sure what the cause might be.

import cats.Id
import cats.implicits._
import github4s.Github
import github4s.Github._
import github4s.GithubResponses.{GHException, GHResponse, UnexpectedException}
import github4s.free.domain._
import github4s.jvm.Implicits._
import scalaj.http._

val github: Github = Github(sys.env.get("GITHUB_TOKEN"))
val response = github.repos.getCombinedStatus("Equiem", "webhooks", "595a30440c9473e7c4fbdb827127c6ab02995561").exec[Id, HttpResponse[String]]()
// response: cats.Id[github4s.GithubResponses.GHResponse[github4s.free.domain.CombinedStatus]] = Left(github4s.GithubResponses$JsonParsingException: Int:
DownField(id),DownArray,DownField(statuses))

Full stack trace:

github4s.GithubResponses$JsonParsingException: Int: DownField(id),DownArray,DownField(statuses)
        at github4s.HttpRequestBuilderExtensionJVM.$anonfun$decodeEntity$1(HttpRequestBuilderExtensionJVM.scala:90)
        at cats.syntax.EitherOps$.bimap$extension(either.scala:129)
        at github4s.HttpRequestBuilderExtensionJVM.decodeEntity(HttpRequestBuilderExtensionJVM.scala:91)
        at github4s.HttpRequestBuilderExtensionJVM.decodeEntity$(HttpRequestBuilderExtensionJVM.scala:88)
        at github4s.jvm.Implicits$.decodeEntity(Implicits.scala:21)
        at github4s.HttpRequestBuilderExtensionJVM$$anon$1.$anonfun$run$1(HttpRequestBuilderExtensionJVM.scala:34)
        at github4s.HttpRequestBuilderExtensionJVM.toEntity(HttpRequestBuilderExtensionJVM.scala:79)
        at github4s.HttpRequestBuilderExtensionJVM.toEntity$(HttpRequestBuilderExtensionJVM.scala:74)
        at github4s.jvm.Implicits$.toEntity(Implicits.scala:21)
        at github4s.HttpRequestBuilderExtensionJVM$$anon$1.$anonfun$runMap$4(HttpRequestBuilderExtensionJVM.scala:69)
        at github4s.IdInstances$$anon$4.capture(Implicits.scala:73)
        at github4s.HttpRequestBuilderExtensionJVM$$anon$1.runMap(HttpRequestBuilderExtensionJVM.scala:69)
        at github4s.HttpRequestBuilderExtensionJVM$$anon$1.run(HttpRequestBuilderExtensionJVM.scala:34)
        at github4s.HttpClient.get(HttpClient.scala:124)
        at github4s.api.Repos.getStatus(Repos.scala:244)
        at github4s.free.interpreters.Interpreters$$anon$1.$anonfun$apply$1(Interpreters.scala:106)
        at cats.data.Kleisli.$anonfun$map$1(Kleisli.scala:19)
        at cats.data.KleisliFlatMap.$anonfun$tailRecM$2(Kleisli.scala:324)
        at cats.package$$anon$1.tailRecM(package.scala:41)
        at github4s.IdInstances$$anon$2.tailRecM(Implicits.scala:87)
        at cats.data.KleisliFlatMap.$anonfun$tailRecM$1(Kleisli.scala:324)
        at github4s.Github$GithubIOSyntaxEither.exec(Github.scala:62)
        at $line17.$read$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$$iw$.<init>(<console>:31)

Response according to curl using the same token:

{
  "state": "success",
  "statuses": [
    {
      "url": "https://api.github.com/repos/Equiem/webhooks/statuses/595a30440c9473e7c4fbdb827127c6ab02995561",
      "id": 4349026842,
      "state": "success",
      "description": "Your tests passed on CircleCI!",
      "target_url": "https://circleci.com/gh/Equiem/webhooks/72?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link",
      "context": "ci/circleci",
      "created_at": "2017-11-27T08:10:20Z",
      "updated_at": "2017-11-27T08:10:20Z"
    }
  ],
  "sha": "595a30440c9473e7c4fbdb827127c6ab02995561",
  "total_count": 1,
  "repository": {
    "id": 90830371,
    "name": "webhooks",
    "full_name": "Equiem/webhooks",
    "owner": {
      "login": "Equiem",
      "id": 1195149,
      "avatar_url": "https://avatars1.githubusercontent.com/u/1195149?v=4",
      "gravatar_id": "",
      "url": "https://api.github.com/users/Equiem",
      "html_url": "https://github.com/Equiem",
      "followers_url": "https://api.github.com/users/Equiem/followers",
      "following_url": "https://api.github.com/users/Equiem/following{/other_user}",
      "gists_url": "https://api.github.com/users/Equiem/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/Equiem/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/Equiem/subscriptions",
      "organizations_url": "https://api.github.com/users/Equiem/orgs",
      "repos_url": "https://api.github.com/users/Equiem/repos",
      "events_url": "https://api.github.com/users/Equiem/events{/privacy}",
      "received_events_url": "https://api.github.com/users/Equiem/received_events",
      "type": "Organization",
      "site_admin": false
    },
    "private": true,
    "html_url": "https://github.com/Equiem/webhooks",
    "description": "Webhook injestion and stuff",
    "fork": false,
    "url": "https://api.github.com/repos/Equiem/webhooks",
    "forks_url": "https://api.github.com/repos/Equiem/webhooks/forks",
    "keys_url": "https://api.github.com/repos/Equiem/webhooks/keys{/key_id}",
    "collaborators_url": "https://api.github.com/repos/Equiem/webhooks/collaborators{/collaborator}",
    "teams_url": "https://api.github.com/repos/Equiem/webhooks/teams",
    "hooks_url": "https://api.github.com/repos/Equiem/webhooks/hooks",
    "issue_events_url": "https://api.github.com/repos/Equiem/webhooks/issues/events{/number}",
    "events_url": "https://api.github.com/repos/Equiem/webhooks/events",
    "assignees_url": "https://api.github.com/repos/Equiem/webhooks/assignees{/user}",
    "branches_url": "https://api.github.com/repos/Equiem/webhooks/branches{/branch}",
    "tags_url": "https://api.github.com/repos/Equiem/webhooks/tags",
    "blobs_url": "https://api.github.com/repos/Equiem/webhooks/git/blobs{/sha}",
    "git_tags_url": "https://api.github.com/repos/Equiem/webhooks/git/tags{/sha}",
    "git_refs_url": "https://api.github.com/repos/Equiem/webhooks/git/refs{/sha}",
    "trees_url": "https://api.github.com/repos/Equiem/webhooks/git/trees{/sha}",
    "statuses_url": "https://api.github.com/repos/Equiem/webhooks/statuses/{sha}",
    "languages_url": "https://api.github.com/repos/Equiem/webhooks/languages",
    "stargazers_url": "https://api.github.com/repos/Equiem/webhooks/stargazers",
    "contributors_url": "https://api.github.com/repos/Equiem/webhooks/contributors",
    "subscribers_url": "https://api.github.com/repos/Equiem/webhooks/subscribers",
    "subscription_url": "https://api.github.com/repos/Equiem/webhooks/subscription",
    "commits_url": "https://api.github.com/repos/Equiem/webhooks/commits{/sha}",
    "git_commits_url": "https://api.github.com/repos/Equiem/webhooks/git/commits{/sha}",
    "comments_url": "https://api.github.com/repos/Equiem/webhooks/comments{/number}",
    "issue_comment_url": "https://api.github.com/repos/Equiem/webhooks/issues/comments{/number}",
    "contents_url": "https://api.github.com/repos/Equiem/webhooks/contents/{+path}",
    "compare_url": "https://api.github.com/repos/Equiem/webhooks/compare/{base}...{head}",
    "merges_url": "https://api.github.com/repos/Equiem/webhooks/merges",
    "archive_url": "https://api.github.com/repos/Equiem/webhooks/{archive_format}{/ref}",
    "downloads_url": "https://api.github.com/repos/Equiem/webhooks/downloads",
    "issues_url": "https://api.github.com/repos/Equiem/webhooks/issues{/number}",
    "pulls_url": "https://api.github.com/repos/Equiem/webhooks/pulls{/number}",
    "milestones_url": "https://api.github.com/repos/Equiem/webhooks/milestones{/number}",
    "notifications_url": "https://api.github.com/repos/Equiem/webhooks/notifications{?since,all,participating}",
    "labels_url": "https://api.github.com/repos/Equiem/webhooks/labels{/name}",
    "releases_url": "https://api.github.com/repos/Equiem/webhooks/releases{/id}",
    "deployments_url": "https://api.github.com/repos/Equiem/webhooks/deployments"
  },
  "commit_url": "https://api.github.com/repos/Equiem/webhooks/commits/595a30440c9473e7c4fbdb827127c6ab02995561",
  "url": "https://api.github.com/repos/Equiem/webhooks/commits/595a30440c9473e7c4fbdb827127c6ab02995561/status"
}
@BenFradet
Copy link
Contributor

mmh they might have changed the payload format compared to what I had written, I'll have a look 👍

@mscharley
Copy link
Contributor Author

It seems that some requests do work (ie, the ones in the tests) but some don't too.

BenFradet added a commit that referenced this issue Dec 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants