Skip to content

feat: add scripts/check-locale-changes #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 6 additions & 62 deletions .github/actions/check-locale-changes/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,73 +11,17 @@ inputs:
outputs:
matrix-include:
description: 'JSON array of locales to deploy with their config'
value: ${{ steps.generate-matrix.outputs.include }}
value: ${{ steps.check-locales.outputs.matrix-include }}
has-changes:
description: 'Whether any enabled locales have changes'
value: ${{ steps.generate-matrix.outputs.has-changes }}
value: ${{ steps.check-locales.outputs.has-changes }}

runs:
using: 'composite'
steps:
- name: Generate dynamic files config (for auto/docs-pr triggers)
if: inputs.trigger-type == 'auto' || inputs.trigger-type == 'docs-pr'
id: generate-files-config
- name: Check locale changes and generate matrix
id: check-locales
shell: bash
run: |
# Use the dedicated script to generate files config
files_yaml=$(.github/scripts/generate-files-config.sh)

echo "Generated files_yaml:"
echo "$files_yaml"

# Save to output for next step
{
echo "files_yaml<<EOF"
echo "$files_yaml"
echo "EOF"
} >> $GITHUB_OUTPUT

- name: Get changed files (for auto/docs-pr triggers)
if: inputs.trigger-type == 'auto' || inputs.trigger-type == 'docs-pr'
id: changes
uses: tj-actions/changed-files@v41
with:
files_yaml: ${{ steps.generate-files-config.outputs.files_yaml }}

- name: Generate deployment matrix
id: generate-matrix
shell: bash
run: |
# Prepare arguments for the matrix generation script
trigger_type="${{ inputs.trigger-type }}"
manual_locales="${{ inputs.manual-locales }}"

if [ "$trigger_type" == "manual" ]; then
# For manual trigger, we don't need changes JSON
output=$(.github/scripts/generate-locale-matrix.sh "$trigger_type" "$manual_locales")
else
# For auto/docs-pr triggers, create a minimal JSON with only the boolean change indicators
changes_json=$(cat << 'EOF'
{
"core_any_changed": "${{ steps.changes.outputs.core_any_changed }}",
"ar_any_changed": "${{ steps.changes.outputs.ar_any_changed }}",
"de_any_changed": "${{ steps.changes.outputs.de_any_changed }}",
"en_any_changed": "${{ steps.changes.outputs.en_any_changed }}",
"es_any_changed": "${{ steps.changes.outputs.es_any_changed }}",
"fr_any_changed": "${{ steps.changes.outputs.fr_any_changed }}",
"ja_any_changed": "${{ steps.changes.outputs.ja_any_changed }}",
"ru_any_changed": "${{ steps.changes.outputs.ru_any_changed }}",
"zh-hans_any_changed": "${{ steps.changes.outputs.zh-hans_any_changed }}",
"zh-hant_any_changed": "${{ steps.changes.outputs.zh-hant_any_changed }}"
}
EOF
)

temp_file=$(mktemp)
echo "$changes_json" > "$temp_file"
output=$(.github/scripts/generate-locale-matrix.sh "$trigger_type" "" "$temp_file")
rm -f "$temp_file"
fi

# Parse the output (the script outputs two lines: include= and has-changes=)
echo "$output" >> $GITHUB_OUTPUT
# Use the unified Node.js script to handle everything
node .github/scripts/check-locale-changes.js "${{ inputs.trigger-type }}" "${{ inputs.manual-locales }}" "true"
Loading