Skip to content

Publish the docs to GitHub Pages with versions and PR previews - #1728

Merged
sergiopaniego merged 11 commits into
mainfrom
docs/github-pages
Nov 25, 2026
Merged

sergiopaniego merged 11 commits into
mainfrom
docs/github-pages

Conversation

@sergiopaniego

@sergiopaniego sergiopaniego commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The docs at huggingface.co/docs/openenv have not updated since 2026-10-22: the doc-builder workflows need HF_DOC_BUILD_PUSH (and COMMENT_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.

Trigger Published at
Push to main https://openenv.github.io/OpenEnv/main/
Release tag vX.Y.Z https://openenv.github.io/OpenEnv/vX.Y.Z/
Pull request https://openenv.github.io/OpenEnv/pr-preview/pr-N/, linked from a comment and removed when the PR closes

How it works:

After merging, a maintainer needs to switch Pages to the branch (no tokens needed):

  1. Settings > Pages > Source: "Deploy from a branch", gh-pages / root. The first run of docs.yml on main creates the branch.
  2. Settings > Environments > github-pages: add gh-pages to the allowed deployment branches (today only main is allowed, which would block the Pages deployment).
  3. Optional: create the docs-preview label, and set the DOCS_SITE_URL repository variable if the docs move to a custom domain.

Links to huggingface.co/docs/openenv in 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

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • New environment
  • Refactoring

Alignment Checklist

Before submitting, verify:

  • I have read .claude/docs/PRINCIPLES.md and this PR aligns with our principles
  • I have checked .claude/docs/INVARIANTS.md and no invariants are violated
  • I have run /pre-submit-pr (or bash .claude/hooks/lint.sh and tests) and addressed all issues

RFC Status

  • Not required (bug fix, docs, minor refactoring)
  • RFC exists: #___
  • RFC needed (will create before merge)

Test Plan

  • Ran the build job's steps locally with the same folder layout as CI, on doc-builder 7b35a31 and 07d98817: 85 pages build, no links left to /docs/openenv/main/en, "Update on GitHub" links point to the right files.
  • Served the result the way GitHub Pages does and checked it in a browser: guides, API reference (autodoc), environment cards, redirects, 404, dark mode, the "Copy page" button, and no console errors. A crawl of every internal link found no 404s (one existing docstring link in reference/cli points outside the docs, also broken on huggingface.co).
  • Built v0.14.0 from its tag with the scripts from this branch.
  • Ran publish.sh against a local bare remote: publishing main, 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 between main and v0.14.0 on the same page and the root redirects to main.
  • actionlint (with shellcheck) on the three workflows, shellcheck on publish.sh, ruff on build_site.py, bash .claude/hooks/lint.sh.
  • Not testable before merge: the workflows on GitHub itself. This PR's own run of docs.yml builds the site, and the preview workflow only runs from main, so the first preview will be on the next docs PR.

Claude Code Review

## Alignment Review Report

### Automated Checks
- Lint: PASS - lint.sh passes (src/ and tests/ unchanged), ruff on docs/pages/build_site.py, actionlint and shellcheck on the workflows and publish.sh
- Debug code: CLEAN for this change - check-debug.sh only lists existing print calls in docstrings under src/

### Open RFCs Context
RFCs 000-003, 005, 006, 008, 012, 014 (In Review) and 010, 011 (Draft) cover environments, harnesses and catalog discovery. None covers docs build or hosting.

### Tier 1: Fixes Required
None

### Tier 2: Alignment Discussion

#### Principle Conflicts
None identified. Hub-facing behavior is unchanged: environments, Spaces and the hf CLI are not touched. The docs move from huggingface.co to GitHub Pages because the Hub upload needs secrets the openenv org does not have.

#### RFC Conflicts
None identified

### Summary
- 0 mechanical issues to fix
- 0 alignment points for human review
- 0 RFC conflicts to discuss

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 the docs-preview label.


Note

Medium Risk
Adds workflows that write to gh-pages and 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.yml builds on main, release tags, and scoped PRs; publishes main and v*.*.* to gh-pages via publish.sh (single-commit branch, force-with-lease retries). docs_pr_preview.yml publishes PR previews from build artifacts with maintainer docs-preview gating for untrusted forks. docs_builder_update.yml weekly tracks the pinned DOC_BUILDER_SHA.

New docs/pages/ tooling: build_site.py wraps doc-builder fragments into full pages (nav, version picker, dark mode, redirects, SEO); build_css.mjs restores production CSS; shell.css adds the standalone look. docs/README.md documents triggers and URLs. Regression test covers path rewrites in build_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.

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.
@burtenshaw burtenshaw added documentation Improvements or additions to documentation size: extra-large Extra-large pull request labels Nov 25, 2026 — with Cursor
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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alignment Review Report

Automated Checks

  • Lint: N/A for this PR's diff — lint.sh only checks src/ and tests/ Python files, and this PR touches only .github/workflows/, docs/README.md, and docs/pages/. (uv isn't installed in this review sandbox, so lint.sh itself couldn't run here, but it wouldn't have covered these files anyway.) Independently: python3 -m py_compile on build_site.py, node --check on build_css.mjs, bash -n on publish.sh, and yaml.safe_load on the three new workflow files all pass.
  • Debug code: CLEAN for this change — check-debug.sh only flags pre-existing print(...) calls/docstrings under src/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 — publish only downloads the static docs-site artifact built by the unprivileged docs.yml run, and remove checks out main.
  • Attacker-controlled values from the workflow_run event (head_branch, head_repository.owner.login) are passed through env: and referenced as $VAR inside run: 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.sh validates dest against a strict regex before touching anything, uses ${pages:?} to guard the rm -rf, and uses --force-with-lease with 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.

Open in Web View Automation 

Sent by Cursor Automation: Pre-review

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ 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.

Comment thread docs/pages/build_site.py Resolved
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.
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size: extra-large Extra-large pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants