This directory contains scripts used by GitHub Actions workflows.
Formats Go coverage output as a markdown table with color-coded indicators.
./format-coverage.sh <coverage-file> [current-coverage] [main-coverage]Arguments:
coverage-file: Path to the Go coverage file (typicallycoverage.out)current-coverage: (optional) Overall coverage percentage for display (e.g., "74.3%")main-coverage: (optional) Main branch coverage percentage for comparison (e.g., "74.0%")
Basic usage:
# Generate coverage file first
mise test-coverage
# Format the coverage report
./.github/scripts/format-coverage.sh coverage.outWith coverage percentages:
# Calculate coverage
COVERAGE=$(go tool cover -func=coverage.out | grep total | awk '{print $3}')
# Format with coverage display
./.github/scripts/format-coverage.sh coverage.out "$COVERAGE"With comparison to main:
./.github/scripts/format-coverage.sh coverage.out "75.2%" "74.3%"The script generates a markdown report with:
- Overall coverage statistics
- Coverage comparison (if main branch coverage provided)
- Table of coverage by package with color-coded indicators:
- 🟢 Green: ≥90% coverage
- 🟡 Yellow: ≥75% coverage
- 🟠 Orange: ≥50% coverage
- 🔴 Red: <50% coverage
- Collapsible detailed coverage by function
To test the output locally:
# Run tests with coverage
mise test-coverage
# Format and preview the output
./.github/scripts/format-coverage.sh coverage.out "74.3%" "74.3%" | lessOr save to a file for inspection:
./.github/scripts/format-coverage.sh coverage.out "74.3%" > coverage-report.md