]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CI: Replace the deprecated `::set-output` command by writing to $GITHUB_OUTPUT in...
authorTim Duesterhus <tim@bastelstu.be>
Fri, 14 Oct 2022 17:46:06 +0000 (19:46 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 14 Oct 2022 17:50:34 +0000 (19:50 +0200)
As announced in

https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/

the `::set-output` command is deprecated, because processes during the workflow
execution might output untrusted information that might include the
`::set-output` command, thus allowing these untrusted information to hijack the
build.

The replacement is writing to the file indicated by the `$GITHUB_OUTPUT`
environment variable.

.github/matrix.py

index 19ae87d79c4ade67be5c778fc0e8bdae4211e25b..76e0893a7beae2362c9c6d0dd3d26ec7c3cd5bc8 100755 (executable)
@@ -12,6 +12,7 @@ import json
 import sys
 import urllib.request
 import re
+from os import environ
 
 if len(sys.argv) == 2:
     build_type = sys.argv[1]
@@ -208,4 +209,6 @@ for CC in ["clang"]:
 
 print(json.dumps(matrix, indent=4, sort_keys=True))
 
-print("::set-output name=matrix::{}".format(json.dumps({"include": matrix})))
+if environ.get('GITHUB_OUTPUT') is not None:
+    with open(environ.get('GITHUB_OUTPUT'), 'a') as f:
+        print("matrix={}".format(json.dumps({"include": matrix})), file=f)