From 78d352f2f2a0e5c716f78bcfdc46ab2636445218 Mon Sep 17 00:00:00 2001 From: lifegpc Date: Sun, 23 Oct 2022 00:23:55 +0000 Subject: [PATCH] Fix deprecated set-output --- scripts/get_cache_key.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/get_cache_key.py b/scripts/get_cache_key.py index 279a705..f6520ab 100644 --- a/scripts/get_cache_key.py +++ b/scripts/get_cache_key.py @@ -1,5 +1,6 @@ from argparse import ArgumentParser from hashlib import sha256 as _sha256 +from os import environ from os.path import exists import sys from time import gmtime, time, strftime @@ -55,7 +56,12 @@ try: h = hash_file(i, args.prefix) d += f"{i}={dt}:{h}\n" print(d) - print(f"::set-output name=cache_key::{sha256(d)}") + github_output = environ.get('GITHUB_OUTPUT', '') + if github_output != '': + with open(github_output, 'a') as f: + f.write(f"cache_key={sha256(d)}\n") + else: + print(f"::set-output name=cache_key::{sha256(d)}") except Exception: from traceback import print_exc from sys import exit