This is a starter site that attempts to follow the following flow:
- During development:
- fetch data from github
- filter and sort the data you got from github
- At build time:
- static results get you a static page
- When accessing the site:
- no API calls to Github's API
npm install gatsby-starter-github-portfolio
- get a personal access token from github.
- create a new file
.envand save your token:
TOKEN=very-long-unreadable-string-goes-here
- modify
gatsby-config.js. Replaceldd(my user name) with yours. For example:
q: "author:someUser is:merged state:closed type:pr sort:comments",
author: "someUser"
-
yarn developornpm developfor development -
yarn buildornpm buildto create a build that you can deploy to your favourite host
You probably want to look at gatsby-source-github-api for how to make valid queries.
Ideally, you should only modify:
gatsby-config.jsto change thegraphQLquery from the github APImain.jsto change thequeryon the datadataParser.jsto filter and sort the data you got
- make sure you have a token and that you saved it in a file named
.env - if you want to make a RAW github v4 Query, do it in
gatsby-config.js- My plugin,
gatsby-source-github-apitakes an optional field,graphQLQuery, that let's you define it
- My plugin,