From 23e048793401900c8d1768b4ffb0fc4ff623ef3e Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Fri, 17 May 2024 15:13:11 -0400 Subject: ci: Surface compiler warnings/errors as GitHub actions messages --- .github/diag.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 .github/diag.sh (limited to '.github/diag.sh') diff --git a/.github/diag.sh b/.github/diag.sh new file mode 100755 index 0000000..942487a --- /dev/null +++ b/.github/diag.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# Copyright © Tavian Barnes +# 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 -E 's/^(([^:]*):([^:]*):([^:]*): (warning|error): (.*))$/::\5 file=\2,line=\3,col=\4,title=Compiler \5::\6\ +\1/' +} + +"$@" 2> >(filter >&2) | filter -- cgit v1.2.3