コンテンツにスキップ

GitHub Actions で output への出力を Python で行う

GitHub Actions のステップから値を output として渡すため、Python でGITHUB_OUTPUTが指すファイルへ追記する。

1
2
3
4
5
6
import os

key = foo
value = bar
with open(os.environ["GITHUB_OUTPUT"], "a") as f :
    print("{0}={1}".format(key, value), file=f)

参考