Skip to content

Commit ced3203

Browse files
committed
feat: add scripts/check-locale-changes
1 parent 99dcca1 commit ced3203

File tree

4 files changed

+476
-67
lines changed

4 files changed

+476
-67
lines changed

.github/actions/check-locale-changes/action.yml

Lines changed: 6 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -11,73 +11,17 @@ inputs:
1111
outputs:
1212
matrix-include:
1313
description: 'JSON array of locales to deploy with their config'
14-
value: ${{ steps.generate-matrix.outputs.include }}
14+
value: ${{ steps.check-locales.outputs.matrix-include }}
1515
has-changes:
1616
description: 'Whether any enabled locales have changes'
17-
value: ${{ steps.generate-matrix.outputs.has-changes }}
17+
value: ${{ steps.check-locales.outputs.has-changes }}
1818

1919
runs:
2020
using: 'composite'
2121
steps:
22-
- name: Generate dynamic files config (for auto/docs-pr triggers)
23-
if: inputs.trigger-type == 'auto' || inputs.trigger-type == 'docs-pr'
24-
id: generate-files-config
22+
- name: Check locale changes and generate matrix
23+
id: check-locales
2524
shell: bash
2625
run: |
27-
# Use the dedicated script to generate files config
28-
files_yaml=$(.github/scripts/generate-files-config.sh)
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/docs-pr triggers)
41-
if: inputs.trigger-type == 'auto' || inputs.trigger-type == 'docs-pr'
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=$(.github/scripts/generate-locale-matrix.sh "$trigger_type" "$manual_locales")
58-
else
59-
# For auto/docs-pr 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=$(.github/scripts/generate-locale-matrix.sh "$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
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"

0 commit comments

Comments
 (0)