File tree Expand file tree Collapse file tree 1 file changed +18
-10
lines changed
Expand file tree Collapse file tree 1 file changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ inputs:
1010 token :
1111 description : ' Personal Access Token'
1212 required : true
13+ template :
14+ description : ' Template for Custom Property Fields'
15+ required : false
1316
1417runs :
1518 using : " composite"
@@ -77,34 +80,39 @@ runs:
7780 echo "Full repo-properties.json file is:"
7881 cat repo-properties.json
7982
80- - name : Convert repo properties JSON to YAML
83+ - name : Convert repo properties to YAML using template
8184 shell : bash
8285 run : |
8386 ORG_NAME=$(cat org-name.txt)
8487
8588 {
8689 echo "org: $ORG_NAME"
8790 echo "repositories:"
88- jq -r '
91+ jq -r --argfile template ${{ inputs.template }} '
8992 to_entries[] |
9093 .key as $repoName |
94+ .value as $props |
95+ $template as $fields |
9196 (
92- " - name: \($repoName)" +
97+ " - name: \($repoName)\n " +
9398 (
94- .value
95- | map(select(.value != ""))
96- | if length > 0 then
97- "\n" + (map(" \(.property_name): \"\(.value)\"") | join("\n"))
98- else
99- ""
100- end
99+ $fields
100+ | map(
101+ . as $key |
102+ (
103+ ($props | map({(.property_name): .value}) | add)[$key] // ""
104+ | " \($key): \"\(.)\""
105+ )
106+ )
107+ | join("\n")
101108 )
102109 )
103110 ' repo-properties.json
104111 } > repo-properties.yaml
105112
106113 echo "YAML written to repo-properties.yaml"
107114
115+
108116
109117 - name : Print out the repo-properties.yaml
110118 shell : bash
You can’t perform that action at this time.
0 commit comments