Automatically generate neat HTML index page for your test reports
π Live Demo β’ π Documentation β’ π€ Contributing β’ π¬ Discussions
- π Smart Discovery - Automatically finds HTML files in your project directories
- π§ Zero Configuration - Works out of the box with sensible defaults
- π― Regex Filtering - Advanced pattern matching to include only the files you need
- π GitHub Pages Ready - Perfect integration with GitHub Pages deployment
Add this action to your workflow to automatically generate an index page for your test reports:
name: Generate Test Reports Index
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
test-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests with coverage
run: npm test -- --coverage
- name: Generate Reports Index
uses: ykmr1224/github-pages-quick-index@v1
with:
reports-path: './reports'
output-file: './index.html'
file-filter: '.*\.(html|htm)$'
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gh-pages-content| Input | Description | Required | Default |
|---|---|---|---|
reports-path |
Directory to scan for HTML files | No | ./reports |
output-file |
Path for the generated index.html | No | ./index.html |
file-filter |
Regex pattern to filter files | No | '' (matches all) |
| Output | Description |
|---|---|
html-files |
JSON array of discovered HTML files |
file-count |
Number of HTML files found |
index-path |
Path to the generated index file |
Perfect for collecting Jest, Mocha, or any HTML test reports:
- name: Generate Test Index
uses: ykmr1224/github-pages-quick-index@v1
with:
reports-path: './test-results'
file-filter: 'test.*\.html$'Organize your documentation files:
- name: Generate Docs Index
uses: ykmr1224/github-pages-quick-index@v1
with:
reports-path: './docs'
file-filter: '.*\.(html|htm)$'Create an index for code coverage reports:
- name: Generate Coverage Index
uses: ykmr1224/github-pages-quick-index@v1
with:
reports-path: './coverage'
file-filter: 'coverage.*\.html$'# Only test reports
file-filter: 'test.*\.html$'
# Coverage and test reports
file-filter: '(test|coverage).*\.html$'
# Exclude temporary files
file-filter: '^(?!.*\.tmp).*\.html$'
# Only files starting with "report"
file-filter: '^report.*\.html$'jobs:
generate-indexes:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Generate separate indexes for different report types
- name: Test Reports Index
uses: ykmr1224/github-pages-quick-index@v1
with:
reports-path: './reports'
output-file: './test-index.html'
file-filter: 'test.*\.html$'
- name: Coverage Reports Index
uses: ykmr1224/github-pages-quick-index@v1
with:
reports-path: './reports'
output-file: './coverage-index.html'
file-filter: 'coverage.*\.html$'- FileCrawler - Recursively discovers HTML files with regex filtering
- TreeFormatter - Organizes files into hierarchical structures
- HtmlGenerator - Creates beautiful, responsive HTML pages
- Template System - Customizable HTML templates with variable substitution
src/
βββ index.ts # Main GitHub Action entry point
βββ file-crawler.ts # File discovery and filtering logic
βββ tree-formatter.ts # Tree structure organization
βββ html-generator.ts # HTML page generation
βββ types.ts # TypeScript type definitions
βββ templates/
βββ index.html # HTML template with placeholders
__tests__/ # Comprehensive test suite
βββ index.test.ts # Integration tests
βββ file-crawler.test.ts # File discovery tests
βββ tree-formatter.test.ts # Tree formatting tests
βββ html-generator.test.ts # HTML generation tests
scripts/ # Build and deployment scripts
βββ embed-template.js # Template embedding for ncc
βββ restore-template.js # Development template restoration
βββ build-with-templates.js # Template build utilities
- Node.js 20+
- npm 8+
# Clone the repository
git clone https://github.com/ykmr1224/github-pages-quick-index.git
cd github-pages-quick-index
# Install dependencies
npm install
# Run tests
npm test
# Run tests with coverage
npm test -- --coverage
# Build the action
npm run build
# Package for distribution
npm run package
# Run all checks
npm run all# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Generate coverage report
npm run test:coverage
# Run specific test file
npm test -- __tests__/file-crawler.test.ts# Test with sample files
node demo.js
# Test regex filtering
node regex-filter-demo.js
# Test HTML generation
node html-generation-demo.js
# Test with real reports
npm test -- --coverage
node -e "
const { run } = require('./dist/index.js');
process.env['INPUT_REPORTS-PATH'] = './reports';
process.env['INPUT_OUTPUT-FILE'] = './test-index.html';
run().catch(console.error);
"This action is used in production by several projects:
- Test Report Aggregation - Collecting Jest, Mocha, and Playwright reports
- Documentation Sites - Organizing API docs, guides, and tutorials
- Coverage Dashboards - Creating navigable coverage report indexes
- CI/CD Artifacts - Organizing build artifacts and deployment reports
The generated index pages feature:
- π± Responsive Design - Works perfectly on desktop and mobile
- π¨ Modern UI - Clean, professional appearance with hover effects
- π Smart Organization - Files grouped by directory with depth-based sorting
- π Quick Navigation - Easy-to-scan file listings with icons
- β‘ Fast Loading - Optimized HTML with minimal overhead
- π Accessibility - Proper semantic HTML and ARIA labels
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.