Skip to content

Commit 01d8513

Browse files
committed
GitHub Actions "annotations" feature doesn't work with colour output
1 parent d8dc8a7 commit 01d8513

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

dev/do/test-indent

+12-9
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ C_YELLOW='\033[1;33m'
1010
C_BLUE='\033[1;34m'
1111
C_RESET='\033[0m'
1212

13-
log() { printf "$*$C_RESET\n"; }
14-
logc() { log "$1$2"; }
15-
succ() { logc "$C_GREEN" "$*"; }
16-
warn() { logc "$C_YELLOW" "$*"; }
17-
err() { logc "$C_RED" "$*"; }
18-
info() { logc "$C_BLUE" "$*"; }
19-
abort() { err "ABORT: $*"; exit 1; }
13+
log() { printf "$*$C_RESET\n"; }
14+
logc() { log "$1$2"; }
15+
succ() { logc "$C_GREEN" "$*"; }
16+
warn() { logc "$C_YELLOW" "$*"; }
17+
err() { logc "$C_RED" "$*"; }
18+
info() { logc "$C_BLUE" "$*"; }
19+
abort() { err "ABORT: $*"; exit 1; }
20+
gh_do() { [ ${GITHUB_ACTIONS:-0} -eq 1 ] && return 0 || return 1; }
2021

2122
pushd "$(dirname "$0")/.."
2223

@@ -39,11 +40,13 @@ test_case_dir='tests'
3940
test_pass() { PASSED+=("$1"); }
4041
test_fail() {
4142
FAILED+=("$1")
42-
err "::error file=dev/$test_case_dir/$1/out.clj::Failed indent test case."
43+
gh_do && echo "::error file=dev/$test_case_dir/$1/out.clj::Failed indent test case."
44+
err "Failed \"$1\""
4345
}
4446
test_skip() {
4547
SKIPPED+=("$1")
46-
warn "::warning file=dev/$test_case_dir/$1/out.clj::Skipped indent test case."
48+
gh_do && echo "::warning file=dev/$test_case_dir/$1/out.clj::Skipped indent test case."
49+
warn "Skipped \"$1\""
4750
}
4851

4952
run_test_case() {

0 commit comments

Comments
 (0)