From 30639668ca11564ee2c0fda77e7e080e3a03c9ed Mon Sep 17 00:00:00 2001 From: William Woodruff Date: Fri, 12 May 2023 11:04:38 -0400 Subject: [PATCH] oidc-exchange: "fix" multiline annotations Signed-off-by: William Woodruff --- oidc-exchange.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/oidc-exchange.py b/oidc-exchange.py index 3259d1f..cc625d3 100644 --- a/oidc-exchange.py +++ b/oidc-exchange.py @@ -74,6 +74,10 @@ def die(msg: str) -> NoReturn: with _GITHUB_STEP_SUMMARY.open("a", encoding="utf-8") as io: print(_ERROR_SUMMARY_MESSAGE.format(message=msg), file=io) + # HACK: GitHub Actions' annotations don't work across multiple lines naively; + # translating `\n` into `%0A` (i.e., HTML percent-encoding) is known to work. + # See: https://github.com/actions/toolkit/issues/193 + msg = msg.replace("\n", "%0A") print(f"::error::Trusted publishing exchange failure: {msg}", file=sys.stderr) sys.exit(1)