Git Product home page Git Product logo

gatsby-source-github-api's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar jeffwinegar avatar ldd avatar pravdomil avatar robincsl avatar yurm04 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gatsby-source-github-api's Issues

Limitations

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?

Breaks on Gatsby v3 because npm package needs published with new version

Hey there,
it looks like this may have already been fixed but just needs to be published to npm

currently the only available version on npm is "version": "0.2.1"

here is the CLI output I get after updating from gatsby v2.x to 3.2.1

 ERROR #11321  PLUGIN

"gatsby-source-github-api" threw an error while running the sourceNodes lifecycle:

Cannot destructure property 'createNode' of 'boundActionCreators' as it is undefined.

   8 | ) => {
   9 |   console.log(boundActionCreators)
> 10 |   const { createNode } = boundActionCreators;
     |           ^
  11 |   return new Promise((resolve, reject) => {
  12 |     // we need a token to use this plugin
  13 |     if (token === undefined) {

File: node_modules\gatsby-source-github-api\gatsby-node.js:10:11

I took the updated code available on GitHub and dropped it in my node_modules\gatsby-source-github-api\gatsby-node.js file and it works fine again.
So thanks for whoever got that updated already, but the package on npm needs to get those updates

Any thoughts on bumping the version to "version": "1.0.1" to allow for major upgrade without breaking the package for gatsby v2 users?

Cant get gatsby-source-github-api to load properly

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

const dotenv = require("dotenv")
    dotenv.config()
    
  plugins: [
    {
      resolve: `gatsby-source-github-api`,
      options: {
        url: "https://api.github.com/graphql",
        token: process.env.GATSBY_GITHUB_ACCESS,
        },
    },
...
]

.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

CT4lV

GitHub Url Docs

EDIT: I can't read -- at first I thought the GitHub url was hard-coded, but I see now it's configurable.

Could the url parameter be added to the examples in the docs? I'm using this with GitHub Enterprise.

Unknown type "Blob"

Hi guys. I got a problem with extracting readme from my repos. I tried the following query:

query {
user(login: "priestine") {
      repositories(
        isFork: false
        first: 25
        isLocked: false
        orderBy: { field: UPDATED_AT, direction: DESC }
      ) {
        nodes {
          name
          url
          forkCount
          openGraphImageUrl
          stargazers {
            totalCount
          }
          fundingLinks {
            url
          }
          object(expression: "master:README.md") {
            ... on Blob {
              text
            }
          }
        }
      }
    }
}

It doesn't start and throws the message:

Unknown type "Blob".

GraphQL request:32:20
31 |           object(expression: "master:README.md") {
32 |             ... on Blob {
   |                    ^
33 |               text

I've tested the query in GitHub GraphQL API Explorer and the query itself is valid and it works. Is it me doing something wrong? Any help would be greatly appreciated. Thanks!

Warning during node transformation when using gatsby-transformer-json

Every time I build my Gatsby app I get this error from the plugin:

 ERROR

Plugin gatsby-transformer-json returned an error Could not find function loadNodeContent for plugin gatsby-source-github-api



  Error: Could not find function loadNodeContent for plugin gatsby-source-github-api

  - nodes.js:58 resolve
    [my-project]/[gatsby]/dist/db/nodes.js:58:15

  - new Promise

  - nodes.js:49 module.exports.loadNodeContent.node
    [my-project]/[gatsby]/dist/db/nodes.js:49:12

  - gatsby-node.js:62 Object.onCreateNode
    [my-project]/[gatsby-transformer-json]/gatsby-node.js:62:25

  - api-runner-node.js:230 runAPI
    [my-project]/[gatsby]/dist/utils/api-runner-node.js:230:37

  - api-runner-node.js:352 resolve
    [my-project]/[gatsby]/dist/utils/api-runner-node.js:352:15

  - debuggability.js:313 Promise._execute
    [my-project]/[bluebird]/js/release/debuggability.js:313:9

  - promise.js:488 Promise._resolveFromExecutor
    [my-project]/[bluebird]/js/release/promise.js:488:18

  - promise.js:79 new Promise
    [my-project]/[bluebird]/js/release/promise.js:79:10

  - api-runner-node.js:351 Promise.mapSeries.plugin
    [my-project]/[gatsby]/dist/utils/api-runner-node.js:351:12

  - util.js:16 tryCatcher
    [my-project]/[bluebird]/js/release/util.js:16:23

  - reduce.js:155 Object.gotValue
    [my-project]/[bluebird]/js/release/reduce.js:155:18

  - reduce.js:144 Object.gotAccum
    [my-project]/[bluebird]/js/release/reduce.js:144:25

  - util.js:16 Object.tryCatcher
    [my-project]/[bluebird]/js/release/util.js:16:23

  - promise.js:517 Promise._settlePromiseFromHandler
    [my-project]/[bluebird]/js/release/promise.js:517:31

  - promise.js:574 Promise._settlePromise
    [my-project]/[bluebird]/js/release/promise.js:574:18

The error is inconsequential and has the app builds fine. As far as I could tell, commenting out this line makes the warning go away but I'm not quite sure why it pops up in the first place. :s

Using this with markdown remark

Hey and at first thanks for this amazin plugin. What i want to achieve is to point gatsby to the repo and reading markdown files out of this and use with remark for generating the graphql schema. is there a way to do that ? Or maybe some pointings in the right direction

Getting contributors on each repostirory?

As far as I am aware, this is not possible with graphql currently, and the default REST Api (v3) is necesssary. How would one go about adding the same here?

I know its necessarily not an issue with this plugin. But I would love to know.

Multiple queries

Can this library run multiple queries?

If it can not, how are you be able to fetch repo information from arbitrary chosen repos?
Just trying to figure out if I am blind.

Thanks!

Multiple queries?

How can I make multiple queries to the Github API? I have a simple query that I want to repeat for two separate orgs and merge the results. Not sure how I can do it with this plugin.

I have (naïvely) tried to repeat the plugin usage but that will not work. Here is my code:
lyft/lyft.github.io#20

Errors handling

Hey,
could You add error handling for graphql requests?
It's simple. I did in my fork :)

In gatsby-node.js you have to do something like this:

 fetchFromGithub(url, token, graphQLQuery, variables).then(result => {
      createNode({
        data: result.data,
        id: result.id || uuid(),
        errors: result.errors || [],

:)

It will be very helpful for users cuz sometimes even github throws an error :)

Gatsby v3.x compatibility

On migrating a Gatsby 2.x project to 3.x, I ran into some issues with this plugin. After some debugging I found that boundActionCreators was removed in the update and actions should now be used in its place.

See this for reference.

Cannot use variables in certain queries

Hello! This might just be me being obtuse, but I cannot get the following query to work with variables

Here is my config object with the query

{
      resolve: `gatsby-source-github-api`,
      options: {
        token: process.env.GITHUB_ACCESS_TOKEN,
        graphQLQuery: `
        {
          search(type: REPOSITORY, query: "user:$userName topic:$topicName", last: 50) {
            repos: edges {
              repo: node {
                ... on Repository {
                  url
                  openGraphImageUrl
                  name
                  description
                }
              }
            }
          }
          user(login: $userName) { 
            pinnedItems(first: 10) {
              nodes {
                ... on Repository {
                  id
                  name
                  description
                  watchers {
                    totalCount
                  }
                  languages(first: 2) {
                    nodes {
                      color
                      name
                    }
                  }
                }
              }
            }
          }
        }        
          `,
        variables: {
          userName: "RyanCross",
          topicName: "game-jam"
        }
      }
    }

The first part of the query works just fine (tested on its own), but this second piece fails
user(login: $userName) {

I believe this has to do with the surrounding quotes, if I replace it with the original value "RyanCross" the query executes fine.

Tried wrapping the variable with quotes in the template string and tried something like:

{ 
variables: {
          userName: "RyanCross",
          userName2: "\"RyanCross\""
        
}

Query still failed on build though :(. Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.