From d958e31b2ba09d475e28f2866d3423013237817e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Carneiro?= Date: Mon, 3 Jul 2023 15:53:34 -0300 Subject: [PATCH] chore: deprecate set-output on second workflow --- .github/workflows/main.yml | 6 +++++- extras/github/docker.py | 8 ++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 55aaac55a..8486f3eb7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,7 +38,11 @@ jobs: matrix = full_matrix else: matrix = reduced_matrix - print('::set-output name=matrix::' + json.dumps(matrix)) + outputs = [] + if os.environ['GITHUB_OUTPUT']: + outputs.append(os.environ['GITHUB_OUTPUT']) + outputs.push('{name}={value}'.format(name='matrix', value=json.dumps(matrix))) + os.environ['GITHUB_OUTPUT'] = '\n'.join(outputs) check-matrix: runs-on: ubuntu-latest needs: matrix diff --git a/extras/github/docker.py b/extras/github/docker.py index 98512fd89..d47eeda58 100644 --- a/extras/github/docker.py +++ b/extras/github/docker.py @@ -3,8 +3,12 @@ from typing import Dict def print_output(output: Dict): - str_output = '\n'.join(['{}={}'.format(k, v) for k, v in output.items()]) - os.environ['GITHUB_OUTPUT'] += str_output + '\n' + outputs = [] + if os.environ['GITHUB_OUTPUT']: + outputs.push(os.environ['GITHUB_OUTPUT']) + for k, v in output.items(): + outputs.push('{name}={value}'.format(name=k, value=v)) + os.environ['GITHUB_OUTPUT'] += '\n'.join(outputs) def prep_base_version(environ: Dict): GITHUB_REF = environ.get('GITHUB_REF')