Skip to content

Commit 0ee11db

Browse files
committed
docs: Pass GH_TOKEN to cargo-binstall to avoid rate limits
When cargo-binstall fetches pre-built binaries from GitHub, it can hit API rate limits (403 Forbidden) when unauthenticated. This causes it to fall back to building from source, which fails for mdbook-linkcheck because the devenv container lacks openssl-devel and the perl modules needed to build OpenSSL from source. Pass the GitHub Actions token through to the container build as a secret, allowing cargo-binstall to make authenticated requests with higher rate limits. Assisted-by: OpenCode (claude-sonnet-4-20250514) Signed-off-by: Colin Walters <walters@verbum.org>
1 parent 760bfca commit 0ee11db

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

.github/workflows/docs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
uses: ./.github/actions/bootc-ubuntu-setup
2424
- name: Build mdbook
2525
run: mkdir target && just build-mdbook-to target/docs
26+
env:
27+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2628
- name: Setup Pages
2729
id: pages
2830
uses: actions/configure-pages@v5

Justfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,14 @@ pullspec-for-os TYPE NAME:
205205
@jq -r --arg v "{{NAME}}" '."{{TYPE}}"[$v]' < hack/os-image-map.json
206206

207207
build-mdbook:
208-
podman build {{generic_buildargs}} -t localhost/bootc-mdbook -f docs/Dockerfile.mdbook .
208+
#!/bin/bash
209+
set -xeuo pipefail
210+
secret_arg=""
211+
# Pass GH_TOKEN to avoid API rate limits when cargo-binstall fetches binaries
212+
if test -n "${GH_TOKEN:-}"; then
213+
secret_arg="--secret=id=GH_TOKEN,env=GH_TOKEN"
214+
fi
215+
podman build {{generic_buildargs}} ${secret_arg} -t localhost/bootc-mdbook -f docs/Dockerfile.mdbook .
209216

210217
# Generate the rendered HTML to the target DIR directory
211218
build-mdbook-to DIR: build-mdbook

docs/Dockerfile.mdbook

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
FROM ghcr.io/bootc-dev/devenv-c10s:latest
22
USER root
33
# Install mdbook tooling via cargo-binstall
4-
RUN <<EORUN
4+
# The GH_TOKEN secret is used to avoid GitHub API rate limits when fetching
5+
# pre-built binaries. Without it, binstall falls back to building from source.
6+
RUN --mount=type=secret,id=GH_TOKEN <<EORUN
57
set -xeuo pipefail
8+
if test -f /run/secrets/GH_TOKEN; then
9+
export GH_TOKEN=$(cat /run/secrets/GH_TOKEN)
10+
fi
611
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
712
deps=(mdbook@0.4.52
813
mdbook-mermaid@0.16.0

0 commit comments

Comments
 (0)