Skip to content

Commit c608442

Browse files
committed
oidc-exchange: context manager
Signed-off-by: William Woodruff <[email protected]>
1 parent 5197747 commit c608442

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

oidc-exchange.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
import id
99
import requests
1010

11-
_GITHUB_STEP_SUMMARY = Path(os.getenv("GITHUB_STEP_SUMMARY")).open("a")
11+
_GITHUB_STEP_SUMMARY = Path(os.getenv("GITHUB_STEP_SUMMARY"))
1212

1313

1414
def die(msg: str) -> NoReturn:
15-
print(msg, file=_GITHUB_STEP_SUMMARY)
15+
with _GITHUB_STEP_SUMMARY.open("a") as io:
16+
print(msg, file=io)
1617

1718
# NOTE: `msg` is Markdown formatted, so we emit only the header line to
1819
# avoid clogging the console log with a full Markdown formatted document.

0 commit comments

Comments
 (0)