-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Print step's output paramaters also to sdtout
This commit makes sure that all steps' output parameters (i.e. GITHUB_OUTPUT) are also printed to stdout, making it easier to debug workflow runs. It also modifies the scripts output logic to only write to GITHUB_OUTPUT if the environment variable is defined, making it easier to run the scripts locally. close #388 Signed-off-by: mgoerens <[email protected]>
- Loading branch information
Showing
2 changed files
with
14 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
import os | ||
|
||
def add_output(name,value): | ||
with open(os.environ['GITHUB_OUTPUT'],'a') as fh: | ||
print(f'{name}={value}',file=fh) | ||
def add_output(key,value): | ||
"""This function prints the key/value pair to stdout in a "key=value" format. | ||
If called from a GitHub workflow, it also sets an output parameter. | ||
""" | ||
|
||
print(f'{key}={value}') | ||
|
||
if "GITHUB_OUTPUT" in os.environ: | ||
with open(os.environ['GITHUB_OUTPUT'],'a') as fh: | ||
print(f'{key}={value}',file=fh) |