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.
- Pulling trees / files from Github repositories
- Pulling release information from Github repositories
This package is available on npm as "@mosch/gatsby-source-github".
yarn add @mosch/gatsby-source-github
// 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",
}
}
}
],
}
- tree: Pulls in the Github tree (all files) as GithubFiles (default false)
- releases: Pulls in the Github releases as GithubReleases (default false)
A a sample query for fetching all File nodes.
query GithubFileQuery {
allGithubFile {
edges {
node {
repository
user
path
}
}
}
}
A a sample query for fetching all Release nodes.
query GithubReleasesQuery {
allGithubReleases {
edges {
node {
user
repository
version
description
}
}
}
}