Skip to content

@indiekit/store-github

GitHub content store adaptor for Indiekit.

Installation

npm install @indiekit/store-github

Requirements

A GitHub personal access token with read and write permissions to a repository.

If creating a fine-grained personal access token, ensure that permissions for your repository include Read access to Metadata and Read and write access to Contents. The token expiration is up to you.

IMPORTANT

Store your personal access token in an environment variable called GITHUB_TOKEN so that only you and the application can see it.

Usage

Add @indiekit/store-github to your list of plug-ins, specifying options as required:

json
{
  "plugins": ["@indiekit/store-github"],
  "@indiekit/store-github": {
    "user": "username",
    "repo": "reponame"
  }
}

Options

OptionTypeDescription
baseUrlstringEnterprise GitHub API URL. Optional, defaults to https://api.github.com.
userstringYour GitHub username. Required.
repostringThe name of your GitHub repository. Required.
branchstringThe branch files will be saved to. Optional, defaults to main.
tokenstringA GitHub personal access token. Required, defaults to process.env.GITHUB_TOKEN.