Skip to content

Commit

Permalink
Write the output to the $GITHUB_OUTPUT file (#17)
Browse files Browse the repository at this point in the history
Co-authored-by: winterjung <[email protected]>
  • Loading branch information
john-jam and winterjung authored Oct 25, 2022
1 parent 0f0d119 commit 7f51d99
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@


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


def print_action_error(msg: str):
Expand Down

0 comments on commit 7f51d99

Please sign in to comment.