Skip to content

Commit 701f630

Browse files
committed
feature: detect and document measurement environment (GitHub Actions vs native)
- Detect GITHUB_ACTIONS and CI environment variables - Label measurements as 'github-actions' or 'ci' vs 'native' - Include environment notes in JSON and text output - Document measurement sources in emoji-widths.json - Helps users understand measurement reliability - Warnings added for CI-measured values that may differ from native terminals
1 parent 9066c02 commit 701f630

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

plugin/emoji-widths.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"$schema": "./emoji-widths.schema.json",
3-
"$comment": "Emoji display widths by terminal. To contribute new measurements, run https://github.com/cowwoc/cat/blob/main/plugin/scripts/measure-emoji-widths.sh",
3+
"$comment": "Emoji display widths by terminal. To contribute new measurements, run https://github.com/cowwoc/cat/blob/main/plugin/scripts/measure-emoji-widths.sh. Use GitHub Actions SSH workflow for testing.",
4+
"measurement_notes": {
5+
"Apple_Terminal": "Measured on GitHub Actions macOS runner via SSH. May differ slightly from native Terminal.app.",
6+
"iTerm.app": "Baseline from Windows Terminal. Actual measurements needed from real iTerm.app installation."
7+
},
48
"emojis": {
59
"closed": "☑️",
610
"in_progress": "🔄",

plugin/scripts/measure-emoji-widths.sh

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,16 +394,29 @@ measure_width() {
394394

395395
main() {
396396
local terminal
397+
local environment="native"
398+
local environment_note=""
397399

398400
terminal=$(detect_terminal)
399401

402+
# Detect if running in CI/cloud environment
403+
if [[ -n "${GITHUB_ACTIONS:-}" ]]; then
404+
environment="github-actions"
405+
environment_note=" (GitHub Actions CI - measurements may differ from native terminal)"
406+
elif [[ -n "${CI:-}" ]] || [[ -n "${CONTINUOUS_INTEGRATION:-}" ]]; then
407+
environment="ci"
408+
environment_note=" (CI environment - measurements may differ from native terminal)"
409+
fi
410+
400411
if $DETECT_ONLY; then
401412
if $JSON_OUTPUT; then
402413
echo "{"
403-
echo " \"terminal\": \"$terminal\""
414+
echo " \"terminal\": \"$terminal\","
415+
echo " \"environment\": \"$environment\""
404416
echo "}"
405417
else
406418
echo "Terminal: $terminal"
419+
echo "Environment: $environment$environment_note"
407420
fi
408421
return
409422
fi
@@ -422,6 +435,10 @@ main() {
422435
if $JSON_OUTPUT; then
423436
echo "{"
424437
echo " \"terminal\": \"$terminal\","
438+
echo " \"environment\": \"$environment\","
439+
if [[ -n "$environment_note" ]]; then
440+
echo " \"note\": \"$environment_note\","
441+
fi
425442
echo " \"widths\": {"
426443

427444
# Collect all measurements first, then output JSON
@@ -455,6 +472,7 @@ main() {
455472
echo "Emoji Width Measurement"
456473
echo "======================="
457474
echo "Terminal: $terminal"
475+
echo "Environment: $environment$environment_note"
458476
echo ""
459477
echo "Widths:"
460478
echo "-------"

0 commit comments

Comments
 (0)