Broken links on travis-ci because of missing github metadata: GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.
Before submitting an issue, please be sure to
- [x] Read the contributing instructions
- [x] Update to the latest Gem version (run
bundle update github-pages)
This issue affects
- [ ] The site generated by GitHub Pages
- [x] Building sites locally
The GitHub Pages Gem is intended to help users replicate the GitHub Pages build environment locally. If your issue affects both the hosted version and the version previewed locally, you may be better suited reporting seeking support in other forums.
What did you do (e.g., steps to reproduce)
I set up my personal site to be built using travis-ci.org. If I use this Gemfile:
source 'https://rubygems.org'
gem "github-pages"
gem "jekyll"
platforms :ruby_21 do
gem "rb-inotify", "~> 0.9"
gem "nokogiri", "~> 1.9"
end
group :jekyll_plugins do
gem "jekyll-feed"
gem "jekyll-paginate"
gem "jekyll-redirect-from"
gem "jekyll-seo-tag"
gem "jekyll-sitemap"
end
group :test do
gem "html-proofer"
end
everything works fine. But if I try to use a short version as suggested by the github-pages gem documentation:
source 'https://rubygems.org'
gem "github-pages", group: :jekyll_plugins
platforms :ruby_21 do
gem "rb-inotify", "~> 0.9"
gem "nokogiri", "~> 1.9"
end
group :test do
gem "html-proofer"
end
The build throws a warning:
GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.
and html-proofer fails with a lot of broken links like this:
- ./_site/2019/02/22/bde-lock.html
* External link https://github.com/pages/dleidert/2019/02/22/bde-lock.html failed: 404 No error
* internally linking to /pages/dleidert/, which does not exist (line 25)
<a class="site-title" rel="author" href="/pages/dleidert/">Daniels user page</a>
Digging around I found a few hints (e.g. in #399), that I should add this
github: [metadata]
repository: dleidert/dleidert.github.io
to my _config.yml and did it. But it still fails. It is missing essential metadata. But I cannot figure out, what is making the difference here. With the first Gemfile variant, I don't need to add anything to my _config.yml and everything works as expected. Further in both Ruby 2.5 environments the same jekyll* and github gems are installed with the same version. I cannot find a difference here. ~~In other environments like 2.1 the gem list is quite different!~~
What did you expect to happen?
I expect, that the pages are built and checked successfully using either of the Gemfiles quoted above.
What happened instead?
The build produces output with broken links because of missing github metadata and leads to errors using a html checker tool like html-proofer
Additional information
- Link to the live site (if applicable):
Succeeding build including a raw log
Failing build including a raw log
- Link to the source repo (if applicable):
Working configuration in the master branch: https://github.com/dleidert/dleidert.github.io/tree/master
Non-working configuration in the github-pages-gem branch: https://github.com/dleidert/dleidert.github.io/tree/github-pages-gem
The warning disappears after creating a personal access token (scope: public_repo) and assgning it to the environment variables GH_TOKEN, GITHUB_TOKEN and JEKYLL_GITHUB_TOKEN. Still the problem persists: the resulting websites contain broken links.
$ bundle exec jekyll build --trace
Configuration file: /home/travis/build/dleidert/dleidert.github.io/_config.yml
Source: /home/travis/build/dleidert/dleidert.github.io
Destination: /home/travis/build/dleidert/dleidert.github.io/_site
Incremental build: disabled. Enable with --incremental
Generating...
Jekyll Feed: Generating feed for posts
done in 0.551 seconds.
Auto-regeneration: disabled. Use --watch to enable.
The command "bundle exec jekyll build --trace" exited with 0.
$ bundle exec htmlproofer --check-external-hash --check-opengraph --check-sri --check-html --check-img-http --enforce-https --timeframe 4w ./_site
Running ["ImageCheck", "ScriptCheck", "LinkCheck", "OpenGraphCheck", "HtmlCheck"] on ["./_site"] on *.html...
Found 40 links in the cache...
Adding 0 links to the cache...
Removing 0 links from the cache...
Checking 8 external links...
Ran on 7 files!
- ./_site/2019/02/22/bde-lock.html
* External link https://github.com/pages/dleidert/2019/02/22/bde-lock.html failed: 404 No error
* internally linking to /pages/dleidert/, which does not exist (line 25)
<a class="site-title" rel="author" href="/pages/dleidert/">Daniels user page</a>
* internally linking to /pages/dleidert/2019/02/22/bde-lock.html, which does not exist (line 62)
<a class="u-url" href="/pages/dleidert/2019/02/22/bde-lock.html" hidden></a>
* internally linking to /pages/dleidert/assets/main.css, which does not exist (line 22)
<link rel="stylesheet" href="/pages/dleidert/assets/main.css">
I found the culprit, although I don't understand, what's happening. Removing the group assignment(?) for the github-pages gem works:
source 'https://rubygems.org'
gem "github-pages"
platforms :ruby_21 do
gem "rb-inotify", "~> 0.9"
gem "nokogiri", "~> 1.9"
end
group :test do
gem "html-proofer"
end
This doesn't work:
source 'https://rubygems.org'
gem "github-pages", group: :jekyll_plugins
platforms :ruby_21 do
gem "rb-inotify", "~> 0.9"
gem "nokogiri", "~> 1.9"
end
group :test do
gem "html-proofer"
end
Do you have any idea, why it does not work with the group assignment?