#!/usr/bin/env bash set -euo pipefail COVERAGE_VOLUME="${1:-}" REPORT_DIR="${2:-}" [ -n "$COVERAGE_VOLUME" ] || { echo "ERROR: coverage volume name required" >&2; exit 1; } [ -n "$REPORT_DIR" ] || { echo "ERROR: report directory required" >&2; exit 1; } HAS_COVERAGE=false if docker run --rm -v "$COVERAGE_VOLUME":/coverage alpine sh -c '[ -d /coverage ] && ls -A /coverage | grep -q .' 2>/dev/null; then mkdir -p "$REPORT_DIR/coverage" docker run --rm -v "$COVERAGE_VOLUME":/coverage alpine tar c -C /coverage . | tar x -C "$REPORT_DIR/coverage" HAS_COVERAGE=true fi cat > "$REPORT_DIR/index.html" << EOF
${GITHUB_SHA:0:8}