public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Eugene Rozenfeld <erozen@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/microsoft/heads/main)] Use environment files instead of set-output command Date: Tue, 2 May 2023 23:18:48 +0000 (GMT) [thread overview] Message-ID: <20230502231848.194C0385842A@sourceware.org> (raw) https://gcc.gnu.org/g:4ba2cfc9c66a606520593814752db73f06c0e2ec commit 4ba2cfc9c66a606520593814752db73f06c0e2ec Author: Eugene Rozenfeld <erozen@microsoft.com> 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: |
next reply other threads:[~2023-05-02 23:18 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-05-02 23:18 Eugene Rozenfeld [this message] -- strict thread matches above, loose matches on Subject: below -- 2023-04-27 23:38 Eugene Rozenfeld
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230502231848.194C0385842A@sourceware.org \ --to=erozen@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).