Skip to content

Commit

Permalink
Rewrite the set_output helper with pathlib
Browse files Browse the repository at this point in the history
  • Loading branch information
webknjaz committed Oct 20, 2022
1 parent c5dcdac commit 70aaefa
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,15 @@ runs:
run: |
# Compute job Python version
import os
import pathlib
import sys
FILE_APPEND_MODE = 'a'
OUTPUTS_FILE_PATH = pathlib.Path(os.environ['GITHUB_OUTPUT'])
def set_output(name, value):
with open(os.getenv('GITHUB_OUTPUT'), 'a') as out:
print(f'{name}={value}', file=out)
with OUTPUTS_FILE_PATH.open(FILE_APPEND_MODE) as outputs_file:
outputs_file.writelines(f'{name}={value}{os.linesep}')
# Input from GHA
origin_python_version = '${{ inputs.origin-python-version }}'
Expand Down Expand Up @@ -210,11 +214,15 @@ runs:
id: collection-metadata
run: |
import os
import pathlib
import yaml
FILE_APPEND_MODE = 'a'
OUTPUTS_FILE_PATH = pathlib.Path(os.environ['GITHUB_OUTPUT'])
def set_output(name, value):
with open(os.getenv('GITHUB_OUTPUT'), 'a') as out:
print(f'{name}={value}', file=out)
with OUTPUTS_FILE_PATH.open(FILE_APPEND_MODE) as outputs_file:
outputs_file.writelines(f'{name}={value}{os.linesep}')
COLLECTION_META_FILE = 'galaxy.yml'
with open(COLLECTION_META_FILE) as galaxy_yml:
Expand Down

0 comments on commit 70aaefa

Please sign in to comment.