From cc7d160874596b83b2d42fd1cc07b30a5a5c53c1 Mon Sep 17 00:00:00 2001 From: kenorb Date: Sat, 24 Feb 2024 23:55:28 +0000 Subject: [PATCH] Sets output via Python script --- action.yml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 1460c98..8aa6d4f 100644 --- a/action.yml +++ b/action.yml @@ -216,6 +216,18 @@ runs: --verbose playbook: run.yml requirements: requirements.yml - - run: echo "MT_FACT=$(jq -c . < /etc/ansible/facts.d/metatrader.fact)" >> $GITHUB_ENV - - run: echo '${{ fromJson(env.MT_FACT) }}' + - name: Sets output + run: | + import json, os + try: + with open("/etc/ansible/facts.d/metatrader.fact", "r") as file: + data = json.load(file) + mt_path = data.get("5").get("path") + with open(os.getenv('GITHUB_ENV'), "a") as file_env: + file_env.write(f"MT_PATH={mt_path}\\n") + except FileNotFoundError: + print("Error: File not found.") + shell: python + - run: echo '${{ fromJson(env.MT_PATH) }}' + shell: bash using: composite