Skip to content

mosch/gatsby-source-github

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gatsby-source-github

Source plugin for pulling data into Gatsby from Github repositories. Works with gatsby-transform-remark if you like to pull markdown files from your repository.

Supports

  • Pulling trees / files from Github repositories
  • Pulling release information from Github repositories

How to use

NPM package

This package is available on npm as "@mosch/gatsby-source-github".

yarn add @mosch/gatsby-source-github

Gatsby Configuration

// In your gatsby-config.js
module.exports = {
  plugins: [
    {
      resolve: `@mosch/gatsby-source-github`,
      options: {           
        repository: "YOUR_REPOSITORY",
        tree: true,
        releases: true,
        user: "YOUR_USER",
        secrets: {
          token: "YOUR_API_TOKEN",
        }
      }
    }
  ],
}

Plugin options

  • tree: Pulls in the Github tree (all files) as GithubFiles (default false)
  • releases: Pulls in the Github releases as GithubReleases (default false)

How to query Files using GraphQL

A a sample query for fetching all File nodes.

query GithubFileQuery {
  allGithubFile {
    edges {
      node {
        repository
        user
        path
      }
    }
  }
}

How to query Releases using GraphQL

A a sample query for fetching all Release nodes.

query GithubReleasesQuery {
  allGithubReleases {
    edges {
      node {
        user
        repository
        version
        description
      }
    }
  }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •