Repository navigation
Publish the docs to GitHub Pages with versions and PR previews - #1728
Conversation
Build the docs with HF doc-builder in GitHub Actions and publish them to GitHub Pages from the gh-pages branch, with no Hugging Face token: main, one folder per release tag, and a preview per pull request that is removed when it closes. docs/pages adds the layout that huggingface.co provides for doc-builder pages (sidebar, styles, version picker, redirects). Remove the huggingface.co doc workflows, which fail since the move to the openenv org because their HF secrets do not exist here. A weekly workflow opens an issue when huggingface/doc-builder moves ahead of the pinned commit.
Label events shared the build's concurrency group, so a bot adding labels cancelled the build in progress and the labeled run then skipped itself. Maintainers re-run the Docs check after adding docs-preview instead.
There was a problem hiding this comment.
Alignment Review Report
Automated Checks
- Lint: N/A for this PR's diff —
lint.shonly checkssrc/andtests/Python files, and this PR touches only.github/workflows/,docs/README.md, anddocs/pages/. (uvisn't installed in this review sandbox, solint.shitself couldn't run here, but it wouldn't have covered these files anyway.) Independently:python3 -m py_compileonbuild_site.py,node --checkonbuild_css.mjs,bash -nonpublish.sh, andyaml.safe_loadon the three new workflow files all pass. - Debug code: CLEAN for this change —
check-debug.shonly flags pre-existingprint(...)calls/docstrings undersrc/openenv/...that this PR doesn't touch.
Open RFCs Context
Scanned all RFCs (000–003, 005, 006, 008, 012, 014 = In Review; 010, 011 = Draft). None of them cover documentation build/hosting infrastructure. Per rfcs/README.md, "documentation improvements" explicitly don't require an RFC, and the PR checklist correctly marks RFC as not required.
Tier 1: Fixes Required
None. I checked for the classic pull_request_target/workflow_run pitfalls specifically and didn't find any:
docs_pr_preview.yml's privileged jobs (publish,remove) never check out or execute PR code —publishonly downloads the staticdocs-siteartifact built by the unprivilegeddocs.ymlrun, andremovechecks outmain.- Attacker-controlled values from the
workflow_runevent (head_branch,head_repository.owner.login) are passed throughenv:and referenced as$VARinsiderun:blocks rather than interpolated directly via${{ }}into the script text, which avoids the usual script-injection vector for this pattern. - The fork-preview gate (
trusted = same-repo OR author is OWNER/MEMBER/COLLABORATOR OR has docs-preview label) is sound and matches the PR description's intent. publish.shvalidatesdestagainst a strict regex before touching anything, uses${pages:?}to guard therm -rf, and uses--force-with-leasewith retries — no secrets are logged or embedded.- Top-level
permissions: {}with least-privilege per-job overrides in all three new workflows.
Tier 2: Alignment Discussion
Principle Conflicts
None identified. This doesn't touch any API, client/server boundary, reward logic, or Hub-facing upload/auth/caching/repo-id behavior — AGENTS.md's "follow the Hugging Face ecosystem" guidance is about Hub-facing actions (upload/delete/Space/auth/caching/repo ids), which this PR doesn't touch; it still uses HF's own doc-builder for the actual rendering. The motivation is also effectively a bug fix: docs builds have been failing with 401s since the HF-side secrets didn't migrate to the openenv org, so moving the hosting to GitHub Pages (while keeping doc-builder as the renderer) is reasonable and self-contained to docs/ and .github/workflows/.
RFC Conflicts
None identified.
Summary
- 0 mechanical issues to fix
- 0 alignment points requiring human review
- 0 RFC conflicts to discuss
Two items already flagged in the PR description are worth a maintainer's explicit sign-off before merge, not because they're misaligned but because they're product/policy choices rather than engineering questions: (1) the site root redirecting to main vs. the latest release, and (2) gating outside-contributor previews behind the docs-preview label. Nice attention to the fork-security pattern throughout.
Sent by Cursor Automation: Pre-review
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 34f26d1. Configure here.
doc-builder links pages under /docs/openenv/<version>/en, so the prefix is now taken from the build folder. Release builds kept the huggingface.co paths in links and script imports before.
- The docs-preview label approves one commit: the preview workflow removes it after publishing, so later pushes from outside contributors need a new review. - Publishing and removing the preview of the same pull request no longer run in parallel, so a preview published while the pull request closes is still removed. - API reference source links point to src/openenv/ (doc-builder's default suffix) instead of a path that does not exist. - Changes to pyproject.toml and uv.lock rebuild the docs on pull requests, since the build installs the package for autodoc.
Revert before merging. docs_pr_preview.yml only runs from main, so this job publishes the preview of #1728 from the pull request itself.
|
The docs for this pull request are available at https://openenv.github.io/OpenEnv/pr-preview/pr-1728/ (commit 827a86c). The preview may take a minute to update and is removed when the pull request closes. |
- Favicon and touch icon drawn from the OpenEnv cube logo, replacing the Svelte icon doc-builder ships with its kit. - Description, Open Graph and Twitter tags on every page, with a social card cropped from the OpenEnv banner, so shared links get a preview. - PR previews are marked noindex so search engines only index main and releases. - Page titles that already name OpenEnv no longer repeat it. - Hide doc-builder's Connect to MCP Client entry, which points to the huggingface.co docs server.
doc-builder's copy menu fetches the page URL with Accept: text/plain, which huggingface.co answers with markdown, and links the index page as "/.md". On GitHub Pages that copied the page HTML and the index link was a 404. The index page now uses its /index URL and that fetch goes to the page's .md file.
The Parameters and Returns labels kept doc-builder's light-mode gray, which is almost invisible on the dark background.
The site no longer sits inside huggingface.co's layout, so it takes its look from the OpenEnv logo, a wireframe cube: monochrome with neutral grays, hairline borders and nearly square corners, in CSS only. - The cube next to the name in the header (regular weight, like the logo) and next to the home page introduction, plus a small footer. - Clearer heading scale, sections starting on a hairline, and a 46rem text column. - Sidebar pages hang from a thin line with the current page marked by a thicker one, and groups open only around the current page. - Tables, code, cards and API reference boxes with hairline borders and no color gradients, notes and tips in monochrome, warnings in color. - Code blocks line up with the text on phones.
This reverts commit 7a48c73.



Summary
The docs at huggingface.co/docs/openenv have not updated since 2026-10-22: the doc-builder workflows need
HF_DOC_BUILD_PUSH(andCOMMENT_BOT_*for previews), which did not move with the repo to the openenv org, so every docs build and PR preview upload fails with a 401. This PR builds the same docs with doc-builder in GitHub Actions and publishes them to GitHub Pages instead, with no Hugging Face token, and adds versioned docs and PR previews.mainhttps://openenv.github.io/OpenEnv/main/vX.Y.Zhttps://openenv.github.io/OpenEnv/vX.Y.Z/https://openenv.github.io/OpenEnv/pr-preview/pr-N/, linked from a comment and removed when the PR closesHow it works:
docs/pages/adds what the Hub provides:build_site.pywraps each page in a full document (sidebar from_toctree.yml, "On this page" list, version picker, dark mode, redirects from_redirects.yml, 404),build_css.mjscompiles the kit's ownapp.css, andshell.cssstyles the layout.docs.ymlbuilds on pushes tomain, release tags and pull requests, and publishesmainand releases. Older releases can be published by running it frommainwith a tag asversion(tested locally withv0.14.0).docs_pr_preview.ymlpublishes previews from aworkflow_run, so pull requests (forks included) build without write access and the privileged job only copies static files, never PR code. Previews are served from the docs domain, so PRs from outside contributors are published only once a maintainer adds thedocs-previewlabel and re-runs the PR's Docs check. Label events do not trigger builds, since bots label PRs right after they open and those runs would cancel the build in progress. The label approves one commit: it is removed once the preview is published, so later pushes need a new review. Publishing and removing the preview of the same PR run one at a time, so a preview published while its PR closes is still removed.publish.shkeepsgh-pagesas a single commit, so the branch does not grow with every publish, and uses--force-with-leasewith retries so concurrent publishes do not overwrite each other.docs_builder_update.ymlruns weekly and keeps one issue open whilehuggingface/doc-buildermain is ahead of the pinned commit, since Dependabot only tracksuses:references. The pin is bumped to the latest doc-builder commit (07d98817), the one Dependabot proposes in build(deps): bump huggingface/doc-builder/.github/workflows/upload_pr_documentation.yml from 7b35a31ae9844db8b177ef3ca869184a79d791f8 to 07d98817a2624c1fe067d4268e1f80d1988cfe71 #1711, build(deps): bump huggingface/doc-builder/.github/workflows/build_main_documentation.yml from 7b35a31ae9844db8b177ef3ca869184a79d791f8 to 07d98817a2624c1fe067d4268e1f80d1988cfe71 #1712 and build(deps): bump huggingface/doc-builder/.github/workflows/build_pr_documentation.yml from 7b35a31ae9844db8b177ef3ca869184a79d791f8 to 07d98817a2624c1fe067d4268e1f80d1988cfe71 #1713.src/openenv/.... The old workflows passed an emptyversion_tag_suffix, so they pointed to paths that do not exist on huggingface.co too.docs/pages/shell.css.noindex.Accept: text/plain, which only huggingface.co answers with markdown. A small script sends it to the page's.mdfile, and index pages use their/indexURL so "View as Markdown" does not link to/.md. The "Connect to MCP Client" entry, which points to huggingface.co's docs server, is hidden.After merging, a maintainer needs to switch Pages to the branch (no tokens needed):
gh-pages/ root. The first run ofdocs.ymlonmaincreates the branch.github-pages: addgh-pagesto the allowed deployment branches (today onlymainis allowed, which would block the Pages deployment).docs-previewlabel, and set theDOCS_SITE_URLrepository variable if the docs move to a custom domain.Links to
huggingface.co/docs/openenvin the README, notebooks and env READMEs are left for a follow-up once the site is live, since the final URL may still change.Type of Change
Alignment Checklist
Before submitting, verify:
.claude/docs/PRINCIPLES.mdand this PR aligns with our principles.claude/docs/INVARIANTS.mdand no invariants are violated/pre-submit-pr(orbash .claude/hooks/lint.shand tests) and addressed all issuesRFC Status
Test Plan
buildjob's steps locally with the same folder layout as CI, on doc-builder7b35a31and07d98817: 85 pages build, no links left to/docs/openenv/main/en, "Update on GitHub" links point to the right files.reference/clipoints outside the docs, also broken on huggingface.co).v0.14.0from its tag with the scripts from this branch.publish.shagainst a local bare remote: publishingmain, a release and PR previews, removing a preview, republishing unchanged content (no-op), rejecting an invalid destination, and two concurrent publishes from separate clones (one retries on top of the other, both kept, still one commit). Then checked the version picker switches betweenmainandv0.14.0on the same page and the root redirects tomain.actionlint(with shellcheck) on the three workflows,shellcheckonpublish.sh,ruffonbuild_site.py,bash .claude/hooks/lint.sh.docs.ymlbuilds the site, and the preview workflow only runs frommain, so the first preview will be on the next docs PR.Claude Code Review
Points worth a reviewer's decision: the root redirects to
main(it could redirect to the latest release instead), and previews for outside contributors are gated by thedocs-previewlabel.Note
Medium Risk
Adds workflows that write to
gh-pagesand gate external PR previews via labels; incorrect publish logic could overwrite docs, but runtime product code is unchanged.Overview
Replaces Hugging Face doc-builder upload workflows (which depended on missing org secrets) with a self-hosted GitHub Pages pipeline that still builds via doc-builder but needs no HF token.
New CI:
docs.ymlbuilds onmain, release tags, and scoped PRs; publishesmainandv*.*.*togh-pagesviapublish.sh(single-commit branch, force-with-lease retries).docs_pr_preview.ymlpublishes PR previews from build artifacts with maintainerdocs-previewgating for untrusted forks.docs_builder_update.ymlweekly tracks the pinnedDOC_BUILDER_SHA.New
docs/pages/tooling:build_site.pywraps doc-builder fragments into full pages (nav, version picker, dark mode, redirects, SEO);build_css.mjsrestores production CSS;shell.cssadds the standalone look.docs/README.mddocuments triggers and URLs. Regression test covers path rewrites inbuild_site.py.Removed:
build_documentation.yml,build_pr_documentation.yml,upload_pr_documentation.yml.Reviewed by Cursor Bugbot for commit 27b0e2b. Bugbot is set up for automated code reviews on this repo. Configure here.