1
0
mirror of https://github.com/danog/gojekyll.git synced 2024-12-02 12:17:48 +01:00

Read GITHUB_TOKEN if JEKYLL_GITHUB_TOKEN does not exist; document this

This commit is contained in:
Oliver Steele 2022-02-06 17:59:44 +08:00
parent 22d846d12b
commit 7296e12486
3 changed files with 38 additions and 29 deletions

View File

@ -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 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 `hyperfine`.
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.
### Coverage ### Coverage

View File

@ -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 language. It provides `build` and `serve` commands, with directory watch and
live reload. live reload.
|   | Gojekyll | Jekyll | Hugo | |   | Gojekyll | Jekyll | Hugo |
|-------------------------|-------------------------------------------|--------|--------------| | ----------------------- | ----------------------------------------- | ------ | ---------------------------- |
| Stable | | ✓ | ✓ | | Stable | | ✓ | ✓ |
| Fast | ✓<br>([~20×Jekyll](./docs/benchmarks.md)) | | ✓ | | Fast | ✓<br>([~20×Jekyll](./docs/benchmarks.md)) | | ✓ |
| Template language | Liquid | Liquid | Go, Ace and Amber templates | | Template language | Liquid | Liquid | Go, Ace and Amber templates |
| SASS | ✓ | ✓ | ✓ | | SASS | ✓ | ✓ | ✓ |
| Jekyll compatibility | [partial](#current-limitations) | ✓ | | | Jekyll compatibility | [partial](#current-limitations) | ✓ | |
| Plugins | [some](./docs/plugins.md) | yes | shortcodes, theme components | | Plugins | [some](./docs/plugins.md) | yes | shortcodes, theme components |
| Windows support | | ✓ | ✓ | | Windows support | | ✓ | ✓ |
| Implementation language | Go | Ruby | Go | | Implementation language | Go | Ruby | Go |
<!-- TOC --> <!-- TOC -->
- [Gojekyll](#gojekyll) - [Usage](#usage)
- [Usage](#usage) - [Installation](#installation)
- [Installation](#installation) - [Binary Downloads](#binary-downloads)
- [Binary Downloads](#binary-downloads) - [From Source](#from-source)
- [From Source](#from-source) - [[Optional] Install command-line autocompletion](#optional-install-command-line-autocompletion)
- [[Optional] Install command-line autocompletion](#optional-install-command-line-autocompletion) - [Status](#status)
- [Status](#status) - [Current Limitations](#current-limitations)
- [Current Limitations](#current-limitations) - [Other Differences](#other-differences)
- [Other Differences](#other-differences) - [Feature Checklist](#feature-checklist)
- [Feature Checklist](#feature-checklist) - [Troubleshooting](#troubleshooting)
- [Contributors](#contributors) - [Contributors](#contributors)
- [Attribution](#attribution) - [Attribution](#attribution)
- [Related](#related) - [Related](#related)
- [License](#license) - [License](#license)
<!-- /TOC --> <!-- /TOC -->
@ -194,6 +194,16 @@ Muzukashii:
- [ ] `doctor`, `import`, `new`, `new-theme` not planned - [ ] `doctor`, `import`, `new`, `new-theme` not planned
- [ ] Windows - [ ] 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 ## Contributors
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
@ -223,7 +233,7 @@ specification. [Contributions of any kind welcome](./CONTRIBUTING.md)!
Gojekyll uses these libraries: Gojekyll uses these libraries:
| Package | Author(s) | Usage | License | | Package | Author(s) | Usage | License |
|--------------------------------------------------------------------------------|--------------------------------------------------------|----------------------------------------|-----------------------------------------| | ------------------------------------------------------------------------------ | ------------------------------------------------------ | -------------------------------------- | --------------------------------------- |
| [github.com/jaschaephraim/lrserver](https://github.com/jaschaephraim/lrserver) | Jascha Ephraim | Live Reload | MIT 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/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 | | [github.com/osteele/liquid](https://github.com/osteele/liquid) | yours truly | Liquid processor | MIT License |
@ -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. They are used under the terms of the MIT License.
| Source | Use | Description | | Source | Use | Description |
|---------------------------------------------------------------------------------|----------------------|------------------------| | ------------------------------------------------------------------------------- | -------------------- | ---------------------- |
| [Jekyll template documentation](https://jekyllrb.com/docs/templates/) | test cases | filter examples | | [Jekyll template documentation](https://jekyllrb.com/docs/templates/) | test cases | filter examples |
| `jekyll help` command | `gojekyll help` text | help text | | `jekyll help` command | `gojekyll help` text | help text |
| [`jekyll-feed` plugin](https://github.com/jekyll/jekyll-feed) | plugin emulation | `feed.xml` template | | [`jekyll-feed` plugin](https://github.com/jekyll/jekyll-feed) | plugin emulation | `feed.xml` template |

View File

@ -88,6 +88,8 @@ func getGitHubRepo(nwo string) (*github.Repository, error) {
var ts oauth2.TokenSource var ts oauth2.TokenSource
if tok := os.Getenv("JEKYLL_GITHUB_TOKEN"); tok != "" { if tok := os.Getenv("JEKYLL_GITHUB_TOKEN"); tok != "" {
ts = oauth2.StaticTokenSource(&oauth2.Token{AccessToken: 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 != "" { } else if tok := os.Getenv("OCTOKIT_ACCESS_TOKEN"); tok != "" {
ts = oauth2.StaticTokenSource(&oauth2.Token{AccessToken: tok}) ts = oauth2.StaticTokenSource(&oauth2.Token{AccessToken: tok})
} }