Skip to content

Commit

Permalink
Merge pull request #3 from mikael-andersson91/patch-1
Browse files Browse the repository at this point in the history
fix: set action output by writing to environment file
  • Loading branch information
jacobtomlinson authored Aug 21, 2023
2 parents eae9416 + cad5973 commit 076d4ea
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import os
import requests # noqa We are just importing this to prove the dependency installed correctly

# Set the output value by writing to the outputs in the Environment File, mimicking the behavior defined here:
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter
def set_github_action_output(output_name, output_value):
f = open(os.path.abspath(os.environ["GITHUB_OUTPUT"]), "a")
f.write(f'{output_name}={output_value}')
f.close()

def main():
my_input = os.environ["INPUT_MYINPUT"]

my_output = f"Hello {my_input}"
my_output = f'Hello {my_input}'

print(f"::set-output name=myOutput::{my_output}")
set_github_action_output('myOutput', my_output)


if __name__ == "__main__":
Expand Down

0 comments on commit 076d4ea

Please sign in to comment.