Skip to content

Commit 23e5734

Browse files
committed
format the JSON output as YAML
Signed-off-by: Andrew Brandt <[email protected]>
1 parent b8806d4 commit 23e5734

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

action.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,24 @@ runs:
7676
run: |
7777
echo "Full repo-properties.json file is:"
7878
cat repo-properties.json
79+
80+
- name: Convert JSON to formatted YAML
81+
shell: bash
82+
run: |
83+
ORG_NAME=$(cat org-name.txt)
84+
echo "org: $ORG_NAME" > repo-properties.yaml
85+
echo "repositories:" >> repo-properties.yaml
86+
87+
jq -r 'to_entries[] |
88+
.key as $repoName |
89+
" - name: \($repoName)\n last-date-modified: \"\"\n" +
90+
(.value | map(" \(.property_name): \"\(.value)\"") | join("\n"))' repo-properties.json >> repo-properties.yaml
91+
92+
echo "YAML written to repo-properties.yaml"
93+
94+
- name: Print out the repo-properties.yaml
95+
shell: bash
96+
run: |
97+
echo "Full repo-properties.yaml file is:"
98+
cat repo-properties.yaml
99+

0 commit comments

Comments
 (0)