Skip to content

Commit

Permalink
Read GITHUB_TOKEN if JEKYLL_GITHUB_TOKEN does not exist; document this
Browse files Browse the repository at this point in the history
  • Loading branch information
osteele committed Feb 6, 2022
1 parent 22d846d commit 7296e12
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 29 deletions.
5 changes: 1 addition & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ hyperfine --warmup 2 "gojekyll build -s ${SITE_SRC}"
```

If you run into an error after a few runs, add the `--show-ouput` option to
`hyperfine`. If the error is "403 API rate limit exceeded", you are probably
building a repository that uses the `jekyll-github-metadata` gem; try setting
the `JEKYLL_GITHUB_TOKEN` environment variable to the value of a GitHub access
token and trying again.
`hyperfine`.

### Coverage

Expand Down
60 changes: 35 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,33 @@ static site generator, written in the [Go](https://golang.org) programming
language. It provides `build` and `serve` commands, with directory watch and
live reload.

|   | Gojekyll | Jekyll | Hugo |
|-------------------------|-------------------------------------------|--------|--------------|
| Stable | |||
| Fast | ✓<br>([~20×Jekyll](./docs/benchmarks.md)) | ||
| Template language | Liquid | Liquid | Go, Ace and Amber templates |
| SASS ||||
| Jekyll compatibility | [partial](#current-limitations) || |
| &nbsp; | Gojekyll | Jekyll | Hugo |
| ----------------------- | ----------------------------------------- | ------ | ---------------------------- |
| Stable | || |
| Fast | ✓<br>([~20×Jekyll](./docs/benchmarks.md)) | | |
| Template language | Liquid | Liquid | Go, Ace and Amber templates |
| SASS ||| |
| Jekyll compatibility | [partial](#current-limitations) || |
| Plugins | [some](./docs/plugins.md) | yes | shortcodes, theme components |
| Windows support | |||
| Implementation language | Go | Ruby | Go |
| Windows support | || |
| Implementation language | Go | Ruby | Go |

<!-- TOC -->

- [Gojekyll](#gojekyll)
- [Usage](#usage)
- [Installation](#installation)
- [Binary Downloads](#binary-downloads)
- [From Source](#from-source)
- [[Optional] Install command-line autocompletion](#optional-install-command-line-autocompletion)
- [Status](#status)
- [Current Limitations](#current-limitations)
- [Other Differences](#other-differences)
- [Feature Checklist](#feature-checklist)
- [Contributors](#contributors)
- [Attribution](#attribution)
- [Related](#related)
- [License](#license)
- [Usage](#usage)
- [Installation](#installation)
- [Binary Downloads](#binary-downloads)
- [From Source](#from-source)
- [[Optional] Install command-line autocompletion](#optional-install-command-line-autocompletion)
- [Status](#status)
- [Current Limitations](#current-limitations)
- [Other Differences](#other-differences)
- [Feature Checklist](#feature-checklist)
- [Troubleshooting](#troubleshooting)
- [Contributors](#contributors)
- [Attribution](#attribution)
- [Related](#related)
- [License](#license)

<!-- /TOC -->

Expand Down Expand Up @@ -194,6 +194,16 @@ Muzukashii:
- [ ] `doctor`, `import`, `new`, `new-theme` – not planned
- [ ] Windows

## Troubleshooting

If the error is "403 API rate limit exceeded", you are probably building a
repository that uses the `jekyll-github-metadata` gem. Try setting the
`JEKYLL_GITHUB_TOKEN`, `JEKYLL_GITHUB_TOKEN`, or `OCTOKIT_ACCESS_TOKEN`
environment variable to the value of a [GitHub personal access
token][personal-access-token] and trying again.

[personal-access-token]: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token

## Contributors

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
Expand Down Expand Up @@ -223,7 +233,7 @@ specification. [Contributions of any kind welcome](./CONTRIBUTING.md)!
Gojekyll uses these libraries:

| Package | Author(s) | Usage | License |
|--------------------------------------------------------------------------------|--------------------------------------------------------|----------------------------------------|-----------------------------------------|
| ------------------------------------------------------------------------------ | ------------------------------------------------------ | -------------------------------------- | --------------------------------------- |
| [github.com/jaschaephraim/lrserver](https://github.com/jaschaephraim/lrserver) | Jascha Ephraim | Live Reload | MIT License |
| [github.com/kyokomi/emoji](https://github.com/kyokomi/emoji) | kyokomi | `jemoji` plugin emulation | MIT License |
| [github.com/osteele/liquid](https://github.com/osteele/liquid) | yours truly | Liquid processor | MIT License |
Expand All @@ -240,7 +250,7 @@ In addition, the following pieces of text were taken from Jekyll and its plugins
They are used under the terms of the MIT License.

| Source | Use | Description |
|---------------------------------------------------------------------------------|----------------------|------------------------|
| ------------------------------------------------------------------------------- | -------------------- | ---------------------- |
| [Jekyll template documentation](https://jekyllrb.com/docs/templates/) | test cases | filter examples |
| `jekyll help` command | `gojekyll help` text | help text |
| [`jekyll-feed` plugin](https://github.com/jekyll/jekyll-feed) | plugin emulation | `feed.xml` template |
Expand Down
2 changes: 2 additions & 0 deletions plugins/github_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ func getGitHubRepo(nwo string) (*github.Repository, error) {
var ts oauth2.TokenSource
if tok := os.Getenv("JEKYLL_GITHUB_TOKEN"); tok != "" {
ts = oauth2.StaticTokenSource(&oauth2.Token{AccessToken: tok})
} else if tok := os.Getenv("GITHUB_TOKEN"); tok != "" {
ts = oauth2.StaticTokenSource(&oauth2.Token{AccessToken: tok})
} else if tok := os.Getenv("OCTOKIT_ACCESS_TOKEN"); tok != "" {
ts = oauth2.StaticTokenSource(&oauth2.Token{AccessToken: tok})
}
Expand Down

0 comments on commit 7296e12

Please sign in to comment.