Skip to content

Instantly share code, notes, and snippets.

@jwo
Last active November 26, 2020 15:11
Show Gist options
  • Save jwo/e49d06f7f76428fa17fb901e7f418cca to your computer and use it in GitHub Desktop.
Save jwo/e49d06f7f76428fa17fb901e7f418cca to your computer and use it in GitHub Desktop.
GraphQL Example for GitHub API repo statuses on a pull request. We know before hand that it's "jwo/react-hover-image" and pull request number 4
{
repository(owner: "jwo", name:"react-hover-image"){
url
pullRequest(number: 4){
number
url
author {
avatarUrl
login
resourcePath
url
}
commits(last: 1){
nodes{
commit{
commitUrl
oid
status {
state
contexts {
state
targetUrl
description
context
}
}
}
}
}
}
}
}
{
"data": {
"repository": {
"url": "https://github.com/jwo/react-hover-image",
"pullRequest": {
"number": 4,
"url": "https://github.com/jwo/react-hover-image/pull/4",
"author": {
"avatarUrl": "https://avatars0.githubusercontent.com/u/123075?v=4",
"login": "jwo",
"resourcePath": "/jwo",
"url": "https://github.com/jwo"
},
"commits": {
"nodes": [
{
"commit": {
"commitUrl": "https://github.com/jwo/react-hover-image/commit/3398892fa4352a8939db9a9908aec20fab3e5f10",
"oid": "3398892fa4352a8939db9a9908aec20fab3e5f10",
"status": {
"state": "SUCCESS",
"contexts": [
{
"state": "SUCCESS",
"targetUrl": "https://codeclimate.com/github/jwo/react-hover-image/pull/4",
"description": "All good!",
"context": "codeclimate"
},
{
"state": "SUCCESS",
"targetUrl": "https://travis-ci.org/jwo/react-hover-image/builds/293220122?utm_source=github_status&utm_medium=notification",
"description": "The Travis CI build passed",
"context": "continuous-integration/travis-ci/pr"
},
{
"state": "SUCCESS",
"targetUrl": "https://travis-ci.org/jwo/react-hover-image/builds/293220075?utm_source=github_status&utm_medium=notification",
"description": "The Travis CI build passed",
"context": "continuous-integration/travis-ci/push"
},
{
"state": "SUCCESS",
"targetUrl": "https://coveralls.io/builds/13904971",
"description": "Coverage remained the same at 92.308%",
"context": "coverage/coveralls"
},
{
"state": "SUCCESS",
"targetUrl": "https://example.com/build/status",
"description": "Building...",
"context": "readme-good/status"
}
]
}
}
}
]
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment