Skip to content

Commit 7f51d99

Browse files
john-jamwinterjung
andauthored
Write the output to the $GITHUB_OUTPUT file (#17)
Co-authored-by: winterjung <[email protected]>
1 parent 0f0d119 commit 7f51d99

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

main.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,13 @@
66

77

88
def set_action_output(name: str, value: str):
9-
print(f'::set-output name={name}::{value}')
9+
# See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
10+
path = os.getenv('GITHUB_OUTPUT')
11+
if not path:
12+
print_action_error('$GITHUB_OUTPUT env is required.')
13+
exit(1)
14+
with open(path, 'a') as github_output_file:
15+
github_output_file.write(f'{name}={value}\n')
1016

1117

1218
def print_action_error(msg: str):

0 commit comments

Comments
 (0)