Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

CI/CD: Fix github workflow issue after migrating from deprecated set-output (#880)

Rich Turnera3997ae7b842
diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml
index c3a61004d..51de94d85 100644
--- a/.github/workflows/ci_cd.yml
+++ b/.github/workflows/ci_cd.yml
@@ -113,7 +113,7 @@ jobs:
run: |
import os
import json
-
+
# Overlay all inputs and secrets onto this jobs outputs
callerInputs = os.getenv("CALLER_INPUTS")
inputs = os.getenv("INPUTS")
@@ -136,21 +136,24 @@ jobs:
secrets = json.loads(secrets['SECRETS'])
# Iterate over secrets then inputs and assign them as outputs on this step
+
if secrets is not None and secrets != 'null':
for key, value in secrets.items():
os.system(f"echo 'Outputting secret: {key}'")
- value=value.replace('%','%25')
- value=value.replace('\n','%0A')
- value=value.replace('\r','%0D')
- os.system(f"echo '{key}={value}' >> $GITHUB_OUTPUT")
+ lines = len(value.split("\n"))
+ if lines > 1:
+ os.system(f"echo '{key}<<EEOOFF\n{value}\nEEOOFF' >> $GITHUB_OUTPUT")
+ else:
+ os.system(f"echo '{key}={value}' >> $GITHUB_OUTPUT")
if inputs is not None and inputs != 'null':
for key, value in inputs.items():
os.system(f"echo 'Outputting input: {key}'")
- value=value.replace('%','%25')
- value=value.replace('\n','%0A')
- value=value.replace('\r','%0D')
- os.system(f"echo '{key}={value}' >> $GITHUB_OUTPUT")
+ lines = len(value.split("\n"))
+ if lines > 1:
+ os.system(f"echo '{key}<<EEOOFF\n{value}\nEEOOFF' >> $GITHUB_OUTPUT")
+ else:
+ os.system(f"echo '{key}={value}' >> $GITHUB_OUTPUT")
env:
CALLER_INPUTS: ${{ toJSON(inputs) }}