This directory contains GitHub-specific configurations and workflows for the Markdown Test Documentation Generator.
docs.yml- Generates documentation with GitHub links when code is pushed to maingenerate-markdown.yml- Triggers documentation generation when test files changedocs-pages.yml- Generates documentation and deploys to GitHub Pagesbuild.yml- Builds and tests the projectlint.yml- Runs ESLint on the codebaserelease.yml- Handles automated releases
The docs-pages.yml workflow automatically:
- Generates test documentation with GitHub links
- Creates a beautiful HTML interface
- Deploys to GitHub Pages for easy sharing
Enable GitHub Pages in your repository settings to use this feature.
Add this to your .github/workflows/docs.yml:
name: Generate Test Documentation
on:
push:
paths:
- "src/**/*.test.ts"
- "test/**/*.test.ts"
jobs:
generate-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: sp-io/markdown-test-docs@main
with:
source: "./src"
output: "./docs/tests"
github-url: ${{ github.server_url }}/${{ github.repository }}
github-branch: ${{ github.ref_name }}
repository-root: "./"| Input | Description | Required | Default |
|---|---|---|---|
source |
Directory containing test files | Yes | ./src |
output |
Output directory for documentation | No | ./doc-tests |
github-url |
GitHub repository URL | No | (empty) |
github-branch |
GitHub branch name | No | main |
repository-root |
Repository root directory | No | ./ |
| Output | Description |
|---|---|
success |
Whether the action completed successfully |
output-dir |
Directory where documentation was generated |
github-enabled |
Whether GitHub linking was enabled |
- Bug Report (
ISSUE_TEMPLATE/bug_report.md) - For reporting bugs - Feature Request (
ISSUE_TEMPLATE/feature_request.md) - For suggesting enhancements
- Pull Request (
pull_request_template.md) - Includes GitHub linking testing checklist
CODEOWNERS- Defines code ownershipdependabot.yml- Automated dependency updatesCONTRIBUTING.md- Contribution guidelines
The workflows are designed to automatically use GitHub linking when:
- Running in GitHub Actions (uses
${{ github.server_url }}/${{ github.repository }}) - Repository information is available in the environment
- Links point directly to source code with line numbers
Workflows automatically detect:
- Repository URL:
${{ github.server_url }}/${{ github.repository }} - Current branch:
${{ github.ref_name }} - Repository root:
./
This ensures generated documentation always links to the correct repository and branch.
See example-usage.yml.template for a complete workflow example you can copy to your repository.
- Automatic Updates: Documentation updates whenever test files change
- GitHub Links: Direct links to source code with line numbers
- GitHub Pages: Optional deployment for public documentation
- Zero Configuration: Works out of the box with sensible defaults
When contributing to this project:
- Test workflows in your fork before submitting PRs
- Update action inputs/outputs documentation when changing the action
- Ensure backwards compatibility with existing workflows
- Test both GitHub linking and fallback behavior
Documentation not updating: Check that workflow has write permissions to repository
Broken GitHub links: Verify github-url and repository-root parameters
Action not found: Ensure you're using the correct repository reference
Pages not deploying: Enable GitHub Pages in repository settings
Enable workflow debugging by setting repository secret:
ACTIONS_STEP_DEBUG = true
This provides detailed logs for troubleshooting workflow issues.