File tree Expand file tree Collapse file tree
composite-actions/fetch-paths Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121 with :
2222 go-version : ' 1.20'
2323
24- # - name: Install jq
25- # shell: bash
26- # run: go install github.com/stedolan/jq@latest
27-
2824 - name : Get changed directories and set matrix
2925 id : set_matrix
3026 shell : bash
@@ -41,14 +37,24 @@ runs:
4137 exit 0
4238 fi
4339
40+ # Process the config.json without jq
41+ if [[ ! -f build/config.json ]]; then
42+ echo "Error: build/config.json not found."
43+ echo "matrix_services=[]" >> $GITHUB_OUTPUT
44+ exit 1
45+ fi
46+
4447 services=$(for changed_dir in $changed_dirs; do
45- jq -r 'to_entries[] | select(.value.service_source_path | contains("'"$changed_dir"'")) | .key' build/config.json
46- done | sort -u | jq -r -s 'map(.)')
48+ grep -oP '"([^"]+)"\s*:\s*{[^}]*"service_source_path"\s*:\s*"[^"]*'"$changed_dir"'[^"]*"}' build/config.json |
49+ sed -n 's/^\s*"\([^"]*\)".*$/\1/p'
50+ done | sort -u | tr '\n' ',' | sed 's/,$//')
4751
4852 if [[ -z "$services" ]]; then
4953 echo "No matching services found in config.json. Skipping service check."
5054 echo "matrix_services=[]" >> $GITHUB_OUTPUT
5155 exit 0
5256 fi
5357
54- echo "matrix_services=$services" >> $GITHUB_OUTPUT
58+ # Format the services as a JSON array
59+ services_json="[$services]"
60+ echo "matrix_services=$services_json" >> $GITHUB_OUTPUT
You can’t perform that action at this time.
0 commit comments