A secure and robust GitHub Action for generating Metanorma sites from source documents with comprehensive configuration options and enhanced security features.
- β Secure: Input validation, sanitization, and secure script execution
- π§ Configurable: Comprehensive options for customizing site generation
- π Cross-platform: Supports Ubuntu, Windows, and macOS runners (7 platforms tested)
- π Observable: Detailed logging and output information with optional timestamps
- π³ Container-ready: Works in Docker containers
- π Version-aware: Handles both legacy and modern Metanorma versions
- π― TypeScript: Written in TypeScript for type safety and maintainability
- β Vitest: Full test coverage with Vitest
- uses: actions-mn/site-gen@v2
with:
source-path: docs
config-file: metanorma.yml
agree-to-terms: trueThis action requires Metanorma CLI to be installed. You can install it using:
- uses: actions-mn/setup@v3- run: gem install metanorma-cli- run: bundle install
# Then use use-bundler: true in this action| Input | Description | Required | Default |
|---|---|---|---|
source-path |
Source path containing the configuration file and documents | No | . |
output-dir |
Output directory for the generated site | No | _site |
config-file |
Metanorma configuration (manifest) file name | No | metanorma.yml |
agree-to-terms |
Agree to all third-party licensing terms | No | false |
install-fonts |
Install missing fonts automatically | No | true |
continue-without-fonts |
Continue processing even when fonts are missing | No | false |
strict |
Run metanorma in strict mode (fail on warnings) | No | false |
progress |
Display progress-related logs during processing | No | false |
use-bundler |
Use bundler to execute metanorma | No | false |
timestamps |
Add timestamps to log output | No | false |
| Output | Description |
|---|---|
site-path |
Path to the generated site directory |
config-used |
Configuration file that was used |
metanorma-version |
Version of metanorma that was used |
name: Generate Site
on: [push]
jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-mn/setup@v3
- uses: actions-mn/site-gen@v2
with:
agree-to-terms: true- uses: actions-mn/site-gen@v2
id: generate
with:
source-path: documents
output-dir: public
config-file: site-config.yml
agree-to-terms: true
install-fonts: true
continue-without-fonts: false
strict: true
progress: true
timestamps: true
- name: Upload site
uses: actions/upload-artifact@v4
with:
name: generated-site
path: ${{ steps.generate.outputs.site-path }}- name: Install dependencies
run: bundle install
- uses: actions-mn/site-gen@v2
with:
use-bundler: true
agree-to-terms: truejobs:
generate:
runs-on: ubuntu-latest
container:
image: metanorma/metanorma:latest
steps:
- uses: actions/checkout@v4
- uses: actions-mn/site-gen@v2
with:
agree-to-terms: true
install-fonts: false
continue-without-fonts: trueThis action includes several security enhancements:
- Input Validation: All inputs are validated for type, length, and content
- Path Sanitization: Protection against path traversal attacks
- Secure Execution: No dynamic script generation or unsafe file operations
- Error Handling: Comprehensive error handling with meaningful messages
- Logging: Structured logging for debugging and monitoring
Error: "Failed to get metanorma version"
- Ensure Metanorma CLI is properly installed
- If using bundler, set
use-bundler: true
Error: "Path traversal detected"
- Check that your paths don't contain
../sequences - Use relative paths within the workspace
Error: "Metanorma site generation failed"
- Check your
metanorma.ymlconfiguration file - Ensure all required documents are present
- Enable
progress: truefor more detailed output
Enable debug logging by setting the ACTIONS_STEP_DEBUG secret to true in your repository settings.
This action exports the following environment variables for debugging:
| Variable | Description |
|---|---|
METANORMA_CMD |
The metanorma command that was used (metanorma or metanorma.exe) |
METANORMA_FLAGS |
The flags that were passed to metanorma |
| Metanorma Version | Support Status |
|---|---|
| >= 1.10.0 | β Full support (modern flags) |
| < 1.10.0 | β Legacy support (legacy flags) |
This action is tested on:
| Platform | Status |
|---|---|
| ubuntu-latest | β |
| macos-14 | β |
| macos-15 | β |
| macos-15-intel | β |
| macos-26 | β |
| windows-2022 | β |
| windows-2025 | β |
| Docker (metanorma/metanorma:latest) | β |
Please see CONTRIBUTING.md for guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
See CHANGELOG.md for a list of changes and version history.