Open iamjmitch opened 4 years ago
Maybe take a look at this: https://github.com/ldd/gatsby-source-github-api/issues/21#issuecomment-650036417
In particular, you do not really get any data so it's possible that the query that you are using is invalid. I looked at that person's source code and found this: https://github.com/orlovedev/orlove.dev/blob/master/gatsby-config.js#L32-L56
Let me know if that helps and if it doesn't, give me a link to your repo and/or a github gist with the relevant code from gatsby-config.js
I hope that helps!
Unfortunately I faced the same problem. Couldn't get the plugin to provide the GitHub queries.
Does anyone have an update on this? I'm unable to get it to work in Gatsby 4.10.3 and I've asked on StackOverflow: "Why am I unable to get any organization repositories from gatsby-source-github-api?"
author here. @soVader I think you are missing an ending }
for your query to work (from the stack overflow question you made)
so instead of
exports.githubApiQuery = `
query($github_login: String!, $repo_count: Int!){
viewer {
organization(login: $github_login) {
login
id
location
name
url
repositories(first: $repo_count, privacy:PRIVATE) {
nodes {
id
name
openGraphImageUrl
createdAt
stargazerCount
url
description
}
}
}
}
`
it should be
exports.githubApiQuery = `
query($github_login: String!, $repo_count: Int!){
viewer {
organization(login: $github_login) {
login
id
location
name
url
repositories(first: $repo_count, privacy:PRIVATE) {
nodes {
id
name
openGraphImageUrl
createdAt
stargazerCount
url
description
}
}
}
}
}
`
Let me know if that fixes it (or if it helps)
@ldd thanks for reaching out really appreciate it. I've built and tested my query in explorer and in Postman with the token as my password using the query of:
query ($github_org: String!, $repo_count: Int!) {
organization(login: $github_org) {
repositories(
first: $repo_count
privacy: PUBLIC
isFork: false
orderBy: {field: UPDATED_AT, direction: DESC}
) {
nodes {
id
name
updatedAt
createdAt
stargazerCount
url
description
}
}
}
}
variables:
{
"github_org": "facebook",
"repo_count": 3
}
my gatsby-config.js for the plugin:
{
resolve: `gatsby-source-github-api`,
options: {
url: 'https://api.github.com/graphql',
// token: required by the GitHub API
token: process.env.GITHUB_TOKEN,
// GraphQLquery: defaults to a search query
graphQLQuery: `
query ($github_org: String!, $repo_count: Int!) {
organization(login: $github_org) {
repositories(
first: $repo_count
privacy: PUBLIC
isFork: false
orderBy: {field: UPDATED_AT, direction: DESC}
) {
nodes {
id
name
updatedAt
createdAt
stargazerCount
url
description
}
}
}
}
`,
// variables: defaults to variables needed for a search query
variables: {
github_org: process.env.GITHUB_ORG,
repo_count: 3,
},
},
},
the above query works in Postman and Explorer. Let me delete everything and start over after a reboot, VSC update and rebuild my config.
Hi,
Sorry if this is not the right place to post this but I cant seem to get this to load up properly.
I goto localhost:8000/___graphql I do now have the option of allGithubData/githubData however there is no user/repo there.
Current gatsby-node.js file
.env file seems to be working fine for other plugins so I don't think that's the problem.
Have tried uninstall package globally and from --save and reinstalling.
What am I doing wrong?
Edit: no issues thrown on gatsby develop