https://github.com/mosch/gatsby-source-github
https://github.com/mosch/gatsby-source-github
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mosch/gatsby-source-github
- Owner: mosch
- Created: 2017-11-03T08:38:34.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2025-03-27T03:34:16.000Z (over 1 year ago)
- Last Synced: 2025-03-31T07:06:53.349Z (over 1 year ago)
- Language: JavaScript
- Size: 29.3 KB
- Stars: 46
- Watchers: 1
- Forks: 7
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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
```javascript
// 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.
```graphql
query GithubFileQuery {
allGithubFile {
edges {
node {
repository
user
path
}
}
}
}
```
### How to query Releases using GraphQL
A a sample query for fetching all Release nodes.
```graphql
query GithubReleasesQuery {
allGithubReleases {
edges {
node {
user
repository
version
description
}
}
}
}
```