summaryrefslogtreecommitdiff
path: root/util/ci/generate_failure_markdown.sh
blob: ccb3eacb3501ead1d307051570bb1501f59bbeb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

set -e

this_script="$(realpath "${BASH_SOURCE[0]}")"
script_dir="$(realpath "$(dirname "$this_script")")"
qmk_firmware_dir="$(realpath "$script_dir/../../")"

dump_failure_info() {
    local failure_file="$1"
    local keyboard=$(cat "$failure_file" | grep 'CI Metadata: KEYBOARD=' | cut -d= -f2)
    local keymap=$(cat "$failure_file" | grep 'CI Metadata: KEYMAP=' | cut -d= -f2)
    echo "## ${keyboard}:${keymap}"
    echo "\`\`\`"
    cat "$failure_file" | sed -e $'s/\x1b\[[0-9;]*m//g' | grep -v "CI Metadata:" | grep -vP "(Entering|Leaving) directory"
    echo "\`\`\`"
}

for failure_file in $(find "$qmk_firmware_dir/.build" -name 'failed.log.*' | sort); do
    dump_failure_info "$failure_file"
done

exit 0