Skip to content

Commit 3b30d6d

Browse files
Fix output format for airflow-variables (#52)
Co-authored-by: Vitalii Savitskii <[email protected]>
1 parent c33d082 commit 3b30d6d

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

read_airflow_variable/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ inputs:
1818
variables_sub_path:
1919
description: Subdirectory with JSON-encoded file with variable
2020
required: false
21-
default: .helm/variables/
21+
default: variables/
2222

2323
outputs:
2424
airflow_variable:

read_airflow_variable/read_airflow_variable.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ OUTPUT=$(cat "$VARIABLES_SUB_PATH/${PROJECT_NAME//-/_}.json")
2020

2121
# Multiline string handling, per Github Community recommendation:
2222
# https://github.community/t/set-output-truncates-multiline-strings/16852/3
23-
OUTPUT="${OUTPUT//'%'/'%25'}"
24-
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
25-
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
23+
# We remove here line endings instead of replacing because we do not need
24+
# pretty JSON in action outputs
25+
OUTPUT="${OUTPUT//$'\n'/''}"
26+
OUTPUT="${OUTPUT//$'\r'/''}"
2627

2728
echo "airflow_variable=$OUTPUT" >> "$GITHUB_OUTPUT"

update_airflow_variables/update_variables.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ OUTPUT=$(cat /tmp/updated.json)
3131

3232
# Multiline string handling, per Github Community recommendation:
3333
# https://github.community/t/set-output-truncates-multiline-strings/16852/3
34-
OUTPUT="${OUTPUT//'%'/'%25'}"
35-
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
36-
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
34+
# We remove here line endings instead of replacing because we do not need
35+
# pretty JSON in action outputs
36+
OUTPUT="${OUTPUT//$'\n'/''}"
37+
OUTPUT="${OUTPUT//$'\r'/''}"
3738

3839
echo "airflow_variable=$OUTPUT" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)