#!/bin/bash set -euo pipefail SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) REPO_ROOT=$(cd "${SCRIPT_DIR}/.." && pwd) fail() { echo "FAIL: $*" >&2 exit 1 } temp_root=$(mktemp -d) lang_summary="${temp_root}/lang_summary.txt" output_dir="${temp_root}/badges" readme_path="${temp_root}/README.md" cat > "${lang_summary}" <<'EOF' python|Python|1200|1,200|12|3572A5|python typescript|TypeScript|800|800|9|3178c6|typescript yaml|YAML|120|120|5|CB171E| EOF python3 "${REPO_ROOT}/.gitea/ci/render_stats_svgs.py" \ --output-dir "${output_dir}" \ --readme-path "${readme_path}" \ --repo "csh/actions-template" \ --generated-by "Gitea Actions" \ --updated-at "2026-05-22 12:00:00 UTC" \ --total-code 2120 \ --formatted-total-code "2,120" \ --total-files 26 \ --formatted-total-files "26" \ --language-count 3 \ --exclude-dirs "node_modules,dist,.git" \ --min-lines-threshold 10 \ --lang-summary "${lang_summary}" test -f "${output_dir}/total-lines.svg" || fail "renderer should create total-lines.svg" test -f "${output_dir}/total-files.svg" || fail "renderer should create total-files.svg" test -f "${output_dir}/language-count.svg" || fail "renderer should create language-count.svg" test -f "${output_dir}/python-lines.svg" || fail "renderer should create per-language svg badges" test -f "${readme_path}" || fail "renderer should create root README.md" grep -q '