summaryrefslogtreecommitdiffstats
path: root/.github/diag.sh
blob: 56b5fcb6fa5a9eb1362aec64ec43b3d960c2eb28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env bash

# Copyright © Tavian Barnes <tavianator@tavianator.com>
# SPDX-License-Identifier: 0BSD

# Convert compiler diagnostics to GitHub Actions messages
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-a-warning-message

set -eu

filter() {
    sed -En 'p; s/^([^:]*):([^:]*):([^:]*): (warning|error): (.*)$/::\4 file=\1,line=\2,col=\3,title=Compiler \4::\5/p'
}

exec "$@" > >(filter) 2> >(filter >&2)