Closed kosirm closed 5 years ago
So! I am not sure if I understand you correctly, but let me give you an example:
https://github.com/ldd/gatsby-starter-github-portfolio/blob/master/gatsby-config.js
In there, I use the graphQL API to access the readme.md text. In that same project, I use some cute tricks to find the first image in the text, etc.
Anyways, if your question is "can I access the code saved in github"? The answer is yes, for sure!
I can even add a little section on how to do it because it is not 100% clear. (It took me some time to find it)
Otherwise, you may have a more complicated question, but if you clarify it, I can surely try to help!
further comment for anybody who sees this:
query {
user( login: "ldd") {
repositories(first: 11){
edges {
node {
readme: object(expression:"master:package.json"){
... on Blob{
text
}
}
}
}
}
}
}
That'll get you the package.json contents for some of my repositories.
Sources: https://stackoverflow.com/questions/44137710/github-graphql-equivalent-of-the-contents-api
Oh, man, that's revelation for me, didn't know it's possible at all... Thank you so much for the info and for your time! 😄 👍
Hi, I'm really interested in using github as a gatsby source with new github graphql api, but I'm not sure if there is api for tree / node implemented yet. If I can use it only for listing issues etc. it's not really valuable source for me. I would like to access json files saved in github. Is this possible?