@@ -2,7 +2,7 @@ name: 'Check Locale Changes'
22description : ' Check which enabled locales have changes and generate deployment matrix'
33inputs :
44 trigger-type :
5- description : ' Type of trigger: "manual", "auto", or "docs-pr "'
5+ description : ' Type of trigger: "manual" or "auto "'
66 required : true
77 manual-locales :
88 description : ' Comma-separated list of locales for manual trigger (optional)'
@@ -11,17 +11,73 @@ inputs:
1111outputs :
1212 matrix-include :
1313 description : ' JSON array of locales to deploy with their config'
14- value : ${{ steps.check-locales .outputs.matrix- include }}
14+ value : ${{ steps.generate-matrix .outputs.include }}
1515 has-changes :
1616 description : ' Whether any enabled locales have changes'
17- value : ${{ steps.check-locales .outputs.has-changes }}
17+ value : ${{ steps.generate-matrix .outputs.has-changes }}
1818
1919runs :
2020 using : ' composite'
2121 steps :
22- - name : Check locale changes and generate matrix
23- id : check-locales
22+ - name : Generate dynamic files config (for auto triggers)
23+ if : inputs.trigger-type == 'auto'
24+ id : generate-files-config
2425 shell : bash
2526 run : |
26- # Use the unified Node.js script to handle everything
27- node .github/scripts/check-locale-changes.js "${{ inputs.trigger-type }}" "${{ inputs.manual-locales }}" "true"
27+ # Use the dedicated script to generate files config
28+ files_yaml=$(node .github/scripts/generate-files-config.js)
29+
30+ echo "Generated files_yaml:"
31+ echo "$files_yaml"
32+
33+ # Save to output for next step
34+ {
35+ echo "files_yaml<<EOF"
36+ echo "$files_yaml"
37+ echo "EOF"
38+ } >> $GITHUB_OUTPUT
39+
40+ - name : Get changed files (for auto triggers)
41+ if : inputs.trigger-type == 'auto'
42+ id : changes
43+ uses : tj-actions/changed-files@v41
44+ with :
45+ files_yaml : ${{ steps.generate-files-config.outputs.files_yaml }}
46+
47+ - name : Generate deployment matrix
48+ id : generate-matrix
49+ shell : bash
50+ run : |
51+ # Prepare arguments for the matrix generation script
52+ trigger_type="${{ inputs.trigger-type }}"
53+ manual_locales="${{ inputs.manual-locales }}"
54+
55+ if [ "$trigger_type" == "manual" ]; then
56+ # For manual trigger, we don't need changes JSON
57+ output=$(node .github/scripts/generate-locale-matrix.js "$trigger_type" "$manual_locales")
58+ else
59+ # For auto triggers, create a minimal JSON with only the boolean change indicators
60+ changes_json=$(cat << 'EOF'
61+ {
62+ "core_any_changed": "${{ steps.changes.outputs.core_any_changed }}",
63+ "ar_any_changed": "${{ steps.changes.outputs.ar_any_changed }}",
64+ "de_any_changed": "${{ steps.changes.outputs.de_any_changed }}",
65+ "en_any_changed": "${{ steps.changes.outputs.en_any_changed }}",
66+ "es_any_changed": "${{ steps.changes.outputs.es_any_changed }}",
67+ "fr_any_changed": "${{ steps.changes.outputs.fr_any_changed }}",
68+ "ja_any_changed": "${{ steps.changes.outputs.ja_any_changed }}",
69+ "ru_any_changed": "${{ steps.changes.outputs.ru_any_changed }}",
70+ "zh-hans_any_changed": "${{ steps.changes.outputs.zh-hans_any_changed }}",
71+ "zh-hant_any_changed": "${{ steps.changes.outputs.zh-hant_any_changed }}"
72+ }
73+ EOF
74+ )
75+
76+ temp_file=$(mktemp)
77+ echo "$changes_json" > "$temp_file"
78+ output=$(node .github/scripts/generate-locale-matrix.js "$trigger_type" "" "$temp_file")
79+ rm -f "$temp_file"
80+ fi
81+
82+ # Parse the output (the script outputs two lines: include= and has-changes=)
83+ echo "$output" >> $GITHUB_OUTPUT
0 commit comments