Skip to content

Commit 486ec8d

Browse files
committed
oidc-exchange: improve errors
Signed-off-by: William Woodruff <[email protected]>
1 parent 48b317d commit 486ec8d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

oidc-exchange.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010

1111
_GITHUB_STEP_SUMMARY = Path(os.getenv("GITHUB_STEP_SUMMARY"))
1212

13+
# The top-level error message that gets rendered.
14+
# This message wraps one of the other templates/messages defined below.
15+
_ERROR_SUMMARY_MESSAGE = """
16+
Trusted publisher (OIDC) exchange failure:
17+
18+
{message}
19+
20+
Read more about trusted publishers at https://docs.pypi.org/trusted-publishers/
21+
"""
22+
1323
# Rendered if OIDC identity token retrieval fails for any reason.
1424
_TOKEN_RETRIEVAL_FAILED_MESSAGE = """
1525
OIDC token retrieval failed: {identity_error}
@@ -53,7 +63,7 @@
5363

5464
def die(msg: str) -> NoReturn:
5565
with _GITHUB_STEP_SUMMARY.open("a", encoding="utf-8") as io:
56-
print(msg, file=io)
66+
print(_ERROR_SUMMARY_MESSAGE.format(message=msg), file=io)
5767

5868
print(f"::error::OIDC exchange failure: {msg}", file=sys.stderr)
5969
sys.exit(1)

0 commit comments

Comments
 (0)