#!/usr/bin/env bash # Shared command timing helpers for CI wrappers. if [[ -n "${BEADS_CI_TIMING_SH_LOADED:-}" ]]; then return 0 fi BEADS_CI_TIMING_SH_LOADED=1 ci_markdown_escape() { local value="$1" value="${value//|/\\|}" printf '%s' "$value" } ci_timing_write_summary() { local label="$1" local duration="$2" local status="$3" [[ -n "${GITHUB_STEP_SUMMARY:-}" ]] || return 0 if [[ -z "${BEADS_CI_TIMING_SUMMARY_HEADER_WRITTEN:-}" ]]; then { printf '### CI command timings\n\n' printf '| Command | Duration | Status |\n' printf '|---|---:|---:|\n' } >>"$GITHUB_STEP_SUMMARY" BEADS_CI_TIMING_SUMMARY_HEADER_WRITTEN=1 fi printf '| %s | %ss | %s |\n' \ "$(ci_markdown_escape "$label")" \ "$duration" \ "$status" >>"$GITHUB_STEP_SUMMARY" } ci_time() { if [[ $# -lt 3 || "$2" != "--" ]]; then printf 'usage: ci_time