On this page
The short answerWhy open-source examples breakDecide what to test and whenMake examples easier to contribute and testRun forked pull request checks safelyA small GitHub Actions workflowTriage findings before assigning workFit the workflow to the projectWhere DocsAlive fitsPasteable maintainer checklistThe sources we checkedFAQThe short answer
Test the examples readers actually follow: run important README and documentation paths in a clean environment when pull requests change docs or public APIs, check the published package at release, and repeat checks on a schedule to catch drift. Treat examples from forked pull requests as untrusted code, and separate likely docs bugs from fragments, credentials, missing fixtures and other results that need context.
Start with the installation and first-use path, then expand coverage as the project can maintain it. Record the package version, operating system, shell, setup and skipped steps for each run. A green result is useful only when maintainers can tell what was tested and what was left out.
DocsAlive extracts examples and runs supported blocks in page order, then classifies findings so maintainers can focus on likely documentation bugs. Its Open source plan provides weekly runs for eligible public projects. Compiled languages are not executed, TypeScript support is limited, and credential-gated examples are classified rather than run with real keys. The broader docs testing guide covers the same practice across project types.
Why open-source examples break
Open-source documentation changes through many routes. A contributor may fix a README typo, add an example for a new option, or copy a working command from an issue. A maintainer may merge the change after reviewing the prose and code but without having the contributor's operating system, credentials or local files. Even a careful review cannot recreate every reader's environment.
A few recurring gaps cause many failures:
| Source of drift | What a reader encounters | Check that can expose it |
|---|---|---|
| Drive-by contributions | A helpful snippet omits an import, assumes local state or uses an undocumented prerequisite | Run the changed page from a clean starting point and review the setup |
| Renamed APIs | An example calls an import, method or argument that changed between releases | Exercise examples when the public API changes |
| Main branch versus published package | Docs describe code merged on the default branch, but a reader installs a release that does not have it | Test the release documentation against the published package |
| Dependency drift | An example that once worked now encounters a changed dependency | Repeat representative runs on a schedule |
| OS or shell assumptions | A command uses shell syntax, paths or tools unavailable in the reader's environment | State the environment and test the supported paths separately |
| Credentials and external services | A reader needs a key, account or remote resource before a call can work | Identify the prerequisite and keep a separate authorized integration check |
| Limited review time | A small maintainer group must evaluate code, prose, CI output and contributor questions | Prioritize high-traffic paths and classify failures before escalating them |
These causes can overlap. A contributor might write an example against an unreleased API, test it on one operating system, and omit the installation step because the package is already present locally. A failure report saying only “command failed” leaves the maintainer to reconstruct all of those assumptions.
The goal is to make that reconstruction inexpensive. A useful report identifies the page and block, records the environment and installed version, and distinguishes a failure in the documentation from a condition the test could not satisfy. See documentation drift for the broader problem.
The README is part of the product
Readers often try the README before opening the full site. Its installation command, smallest example and links to further documentation deserve the same care as the code they describe. A broken import in that first example can stop a reader before they reach a more complete tutorial.
Treat the README as its own starting point. Do not let a test pass because an earlier documentation page installed a dependency or created a file that the README never mentions. If the README deliberately points to a setup guide, make that dependency clear. The README testing guide describes how to choose and check that first path.
Decide what to test and when
A practical test plan follows the promises the project makes to readers. For each important page, identify the package or binary to install, the starting environment, the sequence of commands, any required data and the observable result. Then decide which events should run that path.
| When | What to test | What the result tells you |
|---|---|---|
| Pull request touching docs | Changed complete examples, their prerequisites and nearby steps | Whether the proposed documentation works under the stated setup |
| Pull request touching a public API | Representative examples that use the changed imports, commands, options or behavior | Whether existing documentation needs to change with the API |
| Release preparation | Important paths against the artifact intended for release | Whether the candidate artifact and release docs agree |
| After publication | Installation and important examples against the published package or binary | Whether a reader can obtain and use what actually shipped |
| Scheduled run | Stable, high-value examples against the dependencies and installation path readers use | Whether a change outside the repository has made an example stale |
A pull request check and a release check answer different questions. A checkout can contain a new API that is absent from the latest published package. It is useful to test upcoming documentation against that checkout, but label it as upcoming or version-specific until readers can install the matching release. Conversely, a release check against an old local checkout does not establish that the published artifact contains the promised files.
For a release, record the exact artifact and version used. If the installation instructions refer to a public package, repeat the path against that package after publication. That post-publication result can reveal a packaging or publishing problem, but it cannot prevent a release that has already shipped. The installation docs testing guide and SDK docs testing guide cover those boundaries in more detail.
Scheduled checks serve a different purpose again. They can reveal that a dependency, remote service or install path changed while the project itself was quiet. A schedule should produce a result someone will review. If nobody owns the findings, a recurring failure can become background noise.
Choose a starting set
Do not make the first version of the process depend on testing every page. Start with the README, installation instructions, a first successful operation and one example for each public interface that users commonly reach first. Add migration instructions when a release changes behavior; those pages often need both an old and a new version of the package to be meaningful. The migration guide testing guide explains how to frame that comparison.
For each path, write down:
- The version or artifact under test and how it was obtained.
- The operating system, shell and relevant runtime.
- The commands and setup a reader is expected to perform.
- Files, services and credentials assumed by the page.
- The expected result and any fields that can vary.
- Steps that were skipped, with a reason and an owner for any follow-up.
A test may prepare a fixture to make an example runnable. Keep that preparation visible: if the fixture is necessary for a reader too, the page should explain where it comes from. Similarly, a test that installs a package before running a page should not hide a missing install instruction.
Preserve page order and page boundaries
A tutorial can define a variable in one block and use it later. Run those blocks in the order a reader encounters them, preserving the state that the tutorial establishes. Starting each block independently can turn a valid sequence into several misleading undefined-name failures.
At the same time, start separate pages independently unless the docs explicitly tell readers to carry state between them. An installation on one page should not silently make another page pass. If a journey crosses pages, record that relationship and test the journey as a separate path.
Tabs need an explicit choice too. Different tabs may be alternatives for different languages, shells or package managers. Running them in sequence can create a path no reader would follow. Record which alternative was checked and cover other important alternatives in separate runs.
Make examples easier to contribute and test
Contributor guidance turns review expectations into something a first-time contributor can follow. A short section in CONTRIBUTING.md can ask authors to identify the package version and environment they used, run complete examples, explain fixtures, mark omitted code and avoid real credentials. Include the command contributors should use for the project's own docs checks, along with a way to report a check they cannot run locally.
GitHub's contribution guidelines documentation describes where a repository can place these guidelines and how GitHub makes them discoverable. Keep the rules proportional to the project: a short, reproducible first-use example is more useful than a long policy contributors cannot apply.
A review guide might ask:
- Does the example target a released version, an upcoming version or a particular supported branch?
- Can a reader identify all imports, installation steps and required files?
- Is the fence labeled for the content it actually contains?
- Is any omitted code marked, and is the surrounding explanation clear?
- Are credentials represented by placeholders, with no real key in the repository?
- Has the author stated which operating system and shell the command assumes?
- If a check was skipped, does the pull request explain why?
Use honest fence labels and mark fragments
A fence label is a clue to both a reader and a checker. Use python for Python code, bash for Bash commands and pycon for an interactive Python session. Label a displayed result as output rather than presenting it as a command. Do not label a fragment as a complete program merely to make it look runnable.
A literal ellipsis can show that code has been omitted. Explain what the reader must supply around it. For example, a page can describe a larger function and say that ... represents omitted work. An automated result that skips a fragment is then an accurate description of coverage; it is not evidence that the omitted code works.
Use placeholders for sensitive values, and explain how a reader supplies a real value outside the documentation. Do not put a working key into a public example or ask a forked pull request check to use one. A placeholder also needs context: tell the reader whether it represents a token, a file path or a service address, and which step obtains or creates it. The credentials guide covers ways to separate a readable example from a credential-dependent integration check.
Show stable Python results with an interactive session
A pycon block can show both an expression and its expected result. This example needs only Python's standard library:
>>> from pathlib import PurePosixPath
>>> path = PurePosixPath("docs") / "guide-1.md"
>>> str(path)
'docs/guide-1.md'
>>> path.suffix
'.md'
Save the session as a text file to check it with Python's standard-library doctest:
cat > docs-session.txt <<'EOF'
>>> from pathlib import PurePosixPath
>>> path = PurePosixPath("docs") / "guide-1.md"
>>> str(path)
'docs/guide-1.md'
>>> path.suffix
'.md'
EOF
python -m doctest -v docs-session.txt
The Python doctest documentation describes how it finds interactive sessions and verifies their expected output. Choose stable values for examples intended for exact checking. A timestamp or a response whose ordering changes can distract from the behavior the page is trying to teach.
For an ordinary complete Python block, make its dependencies and result clear as well:
from pathlib import PurePosixPath
page = PurePosixPath("docs") / "guide-1.md"
assert page.suffix == ".md"
print(page.name)
This block runs with the standard library and prints guide-1.md. In a project guide, replace it with a small example of the real public interface and document the installation that makes that interface available. See the Python docs testing guide for a broader test plan.
Route review to people who know the docs
A CODEOWNERS file can associate documentation paths with maintainers or teams who understand the examples. GitHub requests code-owner review for changes to owned files, subject to the rules it describes for draft pull requests and the base branch. Owners need the appropriate repository access; a team must also be visible and have write access. An administrator or owner can configure required code-owner approval where appropriate. See GitHub's code owners documentation.
Ownership should make review easier, not turn one person into a bottleneck. A solo maintainer may simply review the README and public API paths personally. A larger project can assign related docs and code paths to a team, with a documented route for cases that cross ownership boundaries. Reviewers still need the test result and its limitations; a code-owner request does not establish that an example ran.
Run forked pull request checks safely
Documentation examples are code supplied through the repository. A pull request can change a snippet, a test script, setup commands or workflow files. Treat that content and pull request metadata as untrusted input when designing a check.
For checks that execute proposed examples, use a pull_request workflow with the permissions and resources the check actually needs. GitHub states that, for workflows triggered from a forked repository, secrets other than GITHUB_TOKEN are not passed to the runner, and the token has read-only permissions in pull requests from forks. Design the check to work without project secrets. Do not interpret a credential-gated example that was skipped as a successful live API call. See GitHub's workflow event reference.
pull_request_target requires particular care. GitHub warns that privileged workflows using pull_request_target or workflow_run with an untrusted checkout can expose a repository to compromise. Those workflows may have write access and access to referenced secrets, and share the main branch cache with other privileged workflows. GitHub recommends avoiding pull_request_target when it is unnecessary and avoiding these triggers with untrusted pull requests or code content. Do not check out and execute fork code in a privileged workflow. The secure use reference describes these risks and the associated guidance.
Untrusted input also includes values such as pull request titles and other event data. GitHub warns that inserting such values into an inline script can create script injection risks. Its guidance recommends using an action that accepts the value as an argument, or an intermediate environment variable when an inline script must handle it. Review any command that incorporates contributor-controlled data, even if it does not execute a fenced example.
Review approval requests
Depending on repository, organization or enterprise settings, a workflow run from a contributor's fork may require approval from a maintainer with write access. Before approving, inspect the proposed changes and pay particular attention to changes in the workflow directory. Approval means allowing the workflow to run on the proposed branch; it is a separate decision from accepting the contribution.
GitHub says runs awaiting approval for more than 30 days expire and are marked failed. A first-time contributor to a public repository may need a maintainer to approve the run. Document how contributors can ask for help if a check is waiting, and review the fork workflow approval instructions when setting the project's policy.
Keep scheduled checks visible
Scheduled workflows run on the default branch, so ensure that branch contains the documentation and workflow you intend to check. A schedule on the development branch does not by itself prove that every maintained release branch still matches its package.
In a public repository, GitHub automatically disables scheduled workflows after 60 days without repository activity. Scheduled workflows are also disabled by default when a public repository is forked. Check that the workflow remains enabled, and re-enable it when needed using the GitHub interface or the other methods described in GitHub's workflow management documentation. A missing scheduled result is a coverage gap, not a passing run.
A small GitHub Actions workflow
The following outline runs a repository-owned Python doctest file on pull requests and on a weekly schedule. It uses read-only repository contents permission and does not require credentials. Put the workflow in the repository and replace the test file path with a text file the project maintains. The file must exist in the checked-out repository.
name: Documentation examples
on:
pull_request:
schedule:
- cron: "17 4 * * 1"
permissions:
contents: read
jobs:
docs-examples:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: python -m doctest -v docs/examples.txt
This is a starting point, not a complete test of a site. It runs every pull request because it has no path filter; that also catches public API changes that might affect the example. The scheduled run checks the default branch. Add project-specific setup and checks only after deciding what code they execute and what they require.
The job tests the file in the checkout. If that file imports the project, arrange installation in the test environment and record whether the test uses the checkout or a published artifact. A separate release process should verify the package readers receive. This outline also does not cover other shells, operating systems, external services or every code block on a page. The GitHub Actions docs testing guide has more on designing a repository-specific workflow.
Triage findings before assigning work
A raw failure is an observation, not necessarily a documentation defect. A useful triage process asks what the page promised, what the test supplied and whether the result is reproducible under those conditions.
DocsAlive uses statuses to describe execution and categories to explain findings. A pass can mean a block executed or was syntax-checked; a warn can indicate differing output in a pycon session or a deprecation warning; a fail means the block exited with an error; and a skip records a deliberate decision not to run it. Read the category and reason alongside the status.
| Finding | Product category | Maintainer response |
|---|---|---|
| A complete example imports an API absent from the installed version | api-drift |
Check the intended version and correct the example or its version guidance |
| Complete code does not parse | invalid-syntax |
Fix the code if it is meant to be executable; otherwise make the fragment clear |
| A documented package name does not exist | package-not-found |
Verify the intended package and correct the installation instruction |
A pycon session has output from an older runtime |
stale-output |
Reproduce under the stated runtime and update the session if it promises that result |
| A placeholder package or module is intentional | illustrative |
Explain what it stands for; do not treat the placeholder as proof of an install failure |
| An example needs a key | needs-credentials |
Explain how to supply one and use a separate authorized check for the live path |
| An example expects a local file | missing-fixture |
Decide whether the page should create or describe the file, or whether it is a stated prerequisite |
| A name comes from elsewhere or has been elided | depends-on-context |
Check page order and make the dependency or omission clear |
| A package was not installed by the page | missing-install-step |
Review the hint against the page's stated prerequisites |
| A timeout, runtime error or some external network results occur | timeout, runtime-error or network-external |
Investigate the environment and evidence before deciding whether the docs need a fix |
| A tool or supported execution feature is absent | missing-tool, host-tool, runner-gap or unsupported-syntax |
Record the coverage gap and use an appropriate separate check |
The first four rows are docs-bug categories. Other results can still reveal a problem after human review. For example, a missing fixture is not automatically filed as a docs bug, but a page that expects an unexplained file may need better instructions. An external network failure may be transient, or it may reveal a broken documented address; reproduce it before assigning the cause.
Intentional output blocks, alternative tabs and marked fragments can be skipped with reasons such as output-block, alt-variant and fragment. Unsupported or non-executable material can also be skipped. Review those skips as coverage decisions. A report with no likely docs bugs and many skipped blocks does not establish that the entire site works.
For a concrete example of why classification matters, a published run on an open-source AI SDK documentation site extracted 1,327 blocks across 261 pages. It planned 927 for testing, recorded 520 failures and flagged 7 of those failures as likely docs bugs. Those counts describe that particular run, not an expected rate for another project.
Fit the workflow to the project
Solo maintainer
Keep a short list of paths that must work for a new reader: the README, installation and first operation. Run the relevant checks when those pages or the public API change, and inspect a scheduled report at a regular maintenance opportunity. Record known credential and platform gaps in the repository so they do not need to be rediscovered on every contribution.
For a release, check the package a reader can install and update any version-specific instructions. If a finding needs a platform or service the maintainer cannot access, ask a contributor with that environment for a reproducible result. Keep that request specific: include the page, version, expected behavior and steps already attempted.
Small team
Give each important path an owner and agree on what blocks a pull request. A clear API mismatch in a complete example may need a fix before merge; an external timeout may need investigation without assigning blame to the contributor. Review recurring skips as a group and decide which deserve a dedicated test or better prerequisites.
Use contribution guidance and code ownership to route changes. Coordinate release notes, migration instructions and examples with the public API change rather than treating documentation as a separate cleanup task. Keep a record of which checks use the checkout and which use the published package.
Foundation-scale project
Use a shared baseline for fence labels, prerequisites, credentials and result classification, while allowing individual components to own their supported environments. Assign documentation paths to teams with the knowledge and access to review them. Track coverage by component, release line and reader journey so that an aggregate green result does not hide an untested area.
Separate the people who operate a shared checking system from the maintainers who decide whether a result is a documentation bug. Give both groups enough evidence to reproduce findings. For supported platforms, plan explicit runs for the relevant operating systems and shells; a single Linux run cannot establish behavior everywhere.
Where DocsAlive fits
DocsAlive can take a local checkout, a public Git URL or a connected source and detect supported documentation formats, including plain Markdown and MDX. It extracts fenced blocks, plans whether to execute, syntax-check or skip them, and records the reason. It keeps blocks in page order, selects one alternative from a tab group and runs pages in fresh containers. Its reports include findings with page and line information, status, category and reason. See the framework reference and CLI reference for the supported paths and options.
Python and JavaScript examples can be executed within the supported runner. Simple TypeScript type annotations are stripped before execution; other TypeScript-only syntax is not judged, and JSX and TSX are not judged yet. Compiled languages are recognized but not executed. Credential-gated examples are classified rather than executed with real keys; running them with customer-provided test credentials is not currently supported.
For expected output, the product compares printed output line by line for pycon sessions. Design other checks according to what they actually verify, and keep a separate authorized integration test for behavior that needs a real credential or service.
Open source plan and health check
The Open source plan is $0/month for eligible public open-source projects. The repository and docs must be public under an OSI-approved license; private and commercial closed-source docs are not eligible. It covers one public repository and up to 100 docs pages, with weekly scheduled runs, check annotations and a report, a docs health badge, OpenAPI reference checks, Markdown and JSON reports, and best-effort community support without an SLA.
The plan does not include pull-request checks or draft fix PRs. Paid plans with those capabilities start at Team; see pricing. To apply for OSS access, tell the team about the project through the contact page. Access and timing are not guaranteed.
For a one-off assessment, the health check accepts a public GitHub or GitLab repository you own, maintain or are authorized to test. The team runs the engine on up to 40 docs pages and emails the real report within two business days. The checkout is deleted after the run. Use the report to choose a starting set of fixes and identify examples that need a separate test.
Read structured-data results carefully
Structured examples have different limits from executable programs. JSON fences are parsed using Python's JSON parser. That parser accepts NaN, Infinity and -Infinity, and keeps the last value for repeated keys, so a passing result does not establish strict JSON compliance. JSON blocks with comments or ellipsis placeholders are skipped as illustrative; jsonc and json5 blocks are skipped rather than parsed.
TOML fences are checked with Python 3.12's tomllib, which supports TOML 1.0.0. Syntax that is valid only in TOML 1.1.0 could fail that check. YAML fences are not parsed by the runner: a green result with the detail yaml parser not in image; skipped is not a YAML syntax check. Use yamllint or a YAML parser in your own CI for those blocks.
Structured blocks are parsed rather than checked against a schema, so a passing result does not establish that a configuration key exists in the current version of a tool. Review the report's reason and use a tool-specific validation step when the configuration itself is part of the promise.
Pasteable maintainer checklist
Copy this list into a release issue or pull request template and adapt the paths to the project:
- [ ] Identify the README, installation and first-use examples affected by the change.
- [ ] Record the package or binary version, operating system, shell and runtime being tested.
- [ ] Run complete examples in page order from a clean starting environment.
- [ ] Check that required installs, files and other prerequisites are documented.
- [ ] Mark intentional fragments and label code, interactive sessions and output honestly.
- [ ] Use placeholders for keys and record which credential-gated steps were not run.
- [ ] Check relevant examples when a pull request changes docs or a public API.
- [ ] Review fork workflow changes before approving a run that requires approval.
- [ ] Test the release candidate, then repeat important paths against the published package.
- [ ] Review scheduled results and confirm the workflow remains enabled.
- [ ] Triage failures by cause; investigate uncertain and external failures before assigning them.
- [ ] Record skipped languages, alternative tabs, platforms and fixtures as coverage gaps.
- [ ] Assign a maintainer or team to follow up on actionable findings.
For a broader version, see the docs testing checklist and the guide to free docs testing tools.
The sources we checked
These sources were read on November 11, 2026. Product details come from the supplied product facts checked against the site and deployed engine.
| Source | What it covers |
|---|---|
| GitHub Docs: Events that trigger workflows | Pull request events, fork restrictions and scheduled workflows |
| GitHub Docs: Secure use reference | Untrusted input, privileged triggers and untrusted checkouts |
| GitHub Docs: Disabling and enabling a workflow | Scheduled workflow disabling and re-enabling |
| GitHub Docs: Approving workflow runs from forks | Approval settings and maintainer review of fork workflow runs |
| GitHub Docs: About code owners | Ownership, review requests and access requirements |
| GitHub Docs: Setting guidelines for repository contributors | Contribution guideline placement and discoverability |
| Open Source Initiative: Licenses | OSI-approved licenses |
Python documentation: doctest |
Testing interactive Python sessions and expected output |
FAQ
Which open-source documentation should we test first?
Start with the README, installation instructions and the first successful operation a new reader follows. Add examples affected by public API changes and record the versions, environments and prerequisites each path assumes.
Should forked pull requests run documentation code?
They can run checks designed for untrusted contributions. Use appropriate read-only permissions, do not depend on project secrets, and review proposed workflow changes before approving a run that requires approval. Avoid executing an untrusted checkout in a privileged workflow.
Why test against the published package?
A checkout may contain an API or file that has not shipped. Testing the published package checks the installation path available to readers and can reveal packaging or version mismatches that a checkout test does not.
Does every failed example mean the documentation has a bug?
No. A failure may involve an intentional fragment, a missing fixture, credentials, an external service or a limitation of the runner. Review the category, evidence and documented prerequisites before deciding what to fix.
What does the Open source plan include?
Eligible public projects get one public repository, up to 100 docs pages, weekly runs, annotations and a report, a docs health badge, OpenAPI reference checks, Markdown and JSON reports, and best-effort community support without an SLA. Pull-request checks and draft fix PRs start at Team.
Can DocsAlive test every example?
No. Compiled languages are not executed, TypeScript support is limited, and credential-gated examples are classified rather than run with real keys. Check the report for skips and use separate tests for the environments and flows it does not cover.




