From 48f877679b644f04580efbe8ab02ebb8c4918ce1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mitka?= <75326685+lukasz-mitka@users.noreply.github.com> Date: Tue, 14 Feb 2023 06:25:32 +0100 Subject: [PATCH 1/3] Fix output --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 0f30997..f07735d 100644 --- a/main.py +++ b/main.py @@ -541,7 +541,7 @@ async def main( ]: comma_separated_list = ','.join(l) - with open(os.environ['GITHUB_ENV'], 'a') as f: + with open(os.environ['GITHUB_OUTPUT'], 'a') as f: f.write(f'{name}={comma_separated_list}') From 6c1efdae880331c479bd2a9bf1edbc055c3a89e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mitka?= <75326685+lukasz-mitka@users.noreply.github.com> Date: Tue, 14 Feb 2023 11:54:55 +0100 Subject: [PATCH 2/3] Change tests as well --- main_tests.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/main_tests.py b/main_tests.py index 67bb79a..ac7c0f0 100644 --- a/main_tests.py +++ b/main_tests.py @@ -55,12 +55,12 @@ def http_client(ok_response): @pytest.fixture(autouse=True) -def github_env(): +def github_output(): """ - Create a GITHUB_ENV env value to mock the Github actions equivalent. + Create a GITHUB_OUTPUT env value to mock the Github actions equivalent. """ with tempfile.NamedTemporaryFile() as temp: - os.environ['GITHUB_ENV'] = temp.name + os.environ['GITHUB_OUTPUT'] = temp.name yield @@ -589,12 +589,12 @@ async def test_outputs_are_set(mocker): 'token': 'test', } ) - with open(os.environ['GITHUB_ENV']) as f: - env_vars = f.readlines()[0] + with open(os.environ['GITHUB_OUTPUT']) as f: + out_vars = f.readlines()[0] for i in [ 'needs-github-assistance=', 'deleted=', 'failed=', ]: - assert i in env_vars + assert i in out_vars From 9a0622172dc1c605dce41f5be7d69e0386d0c834 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mitka?= <75326685+lukasz-mitka@users.noreply.github.com> Date: Tue, 14 Feb 2023 12:26:02 +0100 Subject: [PATCH 3/3] Fix multiline --- main.py | 2 +- main_tests.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index f07735d..d2d4359 100644 --- a/main.py +++ b/main.py @@ -542,7 +542,7 @@ async def main( comma_separated_list = ','.join(l) with open(os.environ['GITHUB_OUTPUT'], 'a') as f: - f.write(f'{name}={comma_separated_list}') + f.write(f'{name}={comma_separated_list}\n') if __name__ == '__main__': diff --git a/main_tests.py b/main_tests.py index ac7c0f0..da364df 100644 --- a/main_tests.py +++ b/main_tests.py @@ -590,7 +590,7 @@ async def test_outputs_are_set(mocker): } ) with open(os.environ['GITHUB_OUTPUT']) as f: - out_vars = f.readlines()[0] + out_vars = f.read() for i in [ 'needs-github-assistance=',