From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7840) id 194C0385842A; Tue, 2 May 2023 23:18:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 194C0385842A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683069528; bh=kZZHZjMEDMeMmD7gvltQjlxvAhUIl2bz6r357ACQT+c=; h=From:To:Subject:Date:From; b=MxOuKwqj4xiaX8ULFdNSPGld4MHpVdO/1HbLuUUYLjZdwtOupd4YkeCLYnvWy6o35 UOSX4l0MbeumqFITzIBFpTupTloAp2tTKiaLdHHTdXxQ4Fc0LsF4VCc35mna565kYl +gx5S0uUpvdm2bJW9rerAK3+K1oJQJ2s1mSgSWfc= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Eugene Rozenfeld To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/microsoft/heads/main)] Use environment files instead of set-output command X-Act-Checkin: gcc X-Git-Author: Eugene Rozenfeld X-Git-Refname: refs/vendors/microsoft/heads/main X-Git-Oldrev: 37fdfb3e66f865f64c85f22dba0b0586ab0cdab1 X-Git-Newrev: 4ba2cfc9c66a606520593814752db73f06c0e2ec Message-Id: <20230502231848.194C0385842A@sourceware.org> Date: Tue, 2 May 2023 23:18:48 +0000 (GMT) List-Id: https://gcc.gnu.org/g:4ba2cfc9c66a606520593814752db73f06c0e2ec commit 4ba2cfc9c66a606520593814752db73f06c0e2ec Author: Eugene Rozenfeld Date: Wed Apr 26 19:14:09 2023 -0700 Use environment files instead of set-output command set-output command has been deprecated. Diff: --- .github/scripts/common.py | 6 +++++- .github/scripts/config.py | 11 +++++++++-- .github/scripts/gccWorkflow.py | 6 +++++- .github/workflows/update-main.yaml | 4 ++-- .github/workflows/update-mirror-branches.yaml | 2 +- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/scripts/common.py b/.github/scripts/common.py index 58de82132d9..1cee9c2ecbd 100755 --- a/.github/scripts/common.py +++ b/.github/scripts/common.py @@ -25,6 +25,7 @@ import logging import subprocess import requests import time +import os # Exception class to raise when a basic workflow error happens class WorkflowError(Exception): @@ -50,7 +51,10 @@ def GetandPrintCurrentSHA(): res = subprocess.run('git rev-parse HEAD', shell=True, check=False, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # Output for Github to pick up output for future jobs - print("::set-output name=currentSHA::" + str(res.stdout, 'utf-8')) + name = 'currentSHA' + value = str(res.stdout, 'utf-8') + with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: + print(f'{name}={value}', file=fh) def SendGetRestCmd(restCmd, restArgs, restHeader): logger = GetLogger() diff --git a/.github/scripts/config.py b/.github/scripts/config.py index 709e340c4cc..53781ead4a7 100755 --- a/.github/scripts/config.py +++ b/.github/scripts/config.py @@ -26,6 +26,7 @@ import globals from common import * from downloadBuildArtifact import * import sys +import os # subclass JSONEncoder to convert the Config object into JSON class ConfigEncoder(JSONEncoder): @@ -73,7 +74,10 @@ class Config(object): configJson = json.dumps(newConfig, cls=ConfigEncoder) # Output for Github to pick up output for future steps - print("::set-output name=configJson::" + configJson) + name = 'configJson' + value = configJson + with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: + print(f'{name}={value}', file=fh) # Set global config object globals.configObj = newConfig @@ -88,7 +92,10 @@ class Config(object): configJson = json.dumps(globals.configObj, cls=ConfigEncoder) # Output for Github to pick up output for future jobs - print("::set-output name=noSecretConfigJson::" + configJson) + name = 'noSecretConfigJson' + value = configJson + with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: + print(f'{name}={value}', file=fh) @staticmethod def PrintNoSecretConfigJsonFromJson(configJson): diff --git a/.github/scripts/gccWorkflow.py b/.github/scripts/gccWorkflow.py index 411aac30434..585a99a140d 100755 --- a/.github/scripts/gccWorkflow.py +++ b/.github/scripts/gccWorkflow.py @@ -43,7 +43,11 @@ class GccWorkflow(object): "testSet" : ["check-target-libstdc++-v3", "check-gcc-c++", "check-gcc-c", "check-target-libgomp", "check-target-libitm", "check-target-libatomic"] } dictionaryJson = json.dumps(dictionary) - print("::set-output name=testSet::" + dictionaryJson) + + name = 'testSet' + value = dictionaryJson + with open(os.environ['GITHUB_OUTPUT'], 'a') as fh: + print(f'{name}={value}', file=fh) # Runs the configure script to set up gcc configuration environment prior to building and running tests # Creates the objdir directory as part of this process diff --git a/.github/workflows/update-main.yaml b/.github/workflows/update-main.yaml index 636d44ce9c7..82cc94a82cc 100644 --- a/.github/workflows/update-main.yaml +++ b/.github/workflows/update-main.yaml @@ -263,11 +263,11 @@ jobs: - name: Get current date id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H-%M-%S')" + run: echo "date=$(date +'%Y-%m-%dT%H-%M-%S')" >> $GITHUB_OUTPUT - name: Set new branch name id: setBranchName - run: echo "::set-output name=newBranchName::${name}" + run: echo "newBranchName=${name}" >> $GITHUB_OUTPUT env: name: merge-master-${{ needs.gcc-master-build.outputs.masterSHA }}-${{ steps.date.outputs.date }} diff --git a/.github/workflows/update-mirror-branches.yaml b/.github/workflows/update-mirror-branches.yaml index cc7b56fb7f0..baba7ada092 100644 --- a/.github/workflows/update-mirror-branches.yaml +++ b/.github/workflows/update-mirror-branches.yaml @@ -79,7 +79,7 @@ jobs: - name: Get current date id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%dT%H-%M-%S')" + run: echo "date=$(date +'%Y-%m-%dT%H-%M-%S')" >> $GITHUB_OUTPUT - name: Push to branch in GitHub repo run: |